Answers.Body: <p>One hot encoding helps a lot. You can actually one hot encode each batch just before the training to reduce memory usage. One hot encoding makes the input data more intuitive for the network as a numeric value requires the network to do multiple comparisons to understand the value. For examples please tell me which deep learning framework you are using so I can give you some links or code. Hope I can help you.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-15T13:09:48.603Z
Answers.Text: I am trying to solve using encoder-decoder LSTM. especially I also need the 
   intuition/concept of onehot batch encoding, how it works?
Answers.UserDisplayName: Asif Khan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-15T13:20:26.990Z
Answers.Text: What do you mean by one hot batch encoding? Thanks @Asif Khan
Answers.UserDisplayName: Clement
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-15T14:37:46.497Z
Answers.Text: The statement in your answer "You can actually one hot encode each batch just before the training to reduce memory usage.". how to do this
Answers.UserDisplayName: Asif Khan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-15T12:58:25.270Z
Answers.LastActivityDate: 2019-11-15T12:58:25.270Z
Answers.UserDisplayName: Clement
Body: <p>I have a large 2D grid having 30k rows and 35k columns, so a total of 30x35k grid cells. Each grid cell is represented by a unique integer number (identity of grid cell). I have several trajectories that passes through these grid cells. Each trajectory is represented by a sequence of numbers (that are grid cells through which the trajectory passes through). </p>
  
  <p>I want to solve the problem of <strong>trajectory prediction</strong> by giving the partial trajectory as input and predict the full trajectory. This becomes a sequence to sequence problem, where all sequences are integer values by default.</p>
  
  <p>I am trying to solve this problem through encoder-decoder LSTM architecture. Most tutorials/examples regarding sequence to sequence on net are on machine translations in which vocabularies or characters are <strong>one-hot-encoded</strong> to represent the text as integer values. When I hot-encode my sequence values the one-hot vector becomes very large because there are (30x35)k grid cells, the program has given memory overflow error (because each vector has of size 1 million). </p>
  
  <p>I am confused here, do I need to treat grid identity as categorical variable? because all grid identities are numeric numbers but these identities are not comparable (like prices). </p>
  
  <p>Do I need to hot-encode my integer values in my sequence? Or is there any other alternative to solve this problem? I also appreciate if you suggest me the <strong>similar tutorials</strong> having the sequence to sequence prediction problem. </p>
  
Tags: <deep-learning><keras><long-short-term-memory>
Title: How to represent integer values in sequence to sequence prediction task in encoder-decoder LSTM?
UserDisplayName: Asif Khan
ThreadText: # How to represent integer values in sequence to sequence prediction task in encoder-decoder LSTM?
  
  (Asked by: username_0 on 2019-11-15)
  
  I have a large 2D grid having 30k rows and 35k columns, so a total of 30x35k grid cells. Each grid cell is represented by a unique integer number (identity of grid cell). I have several trajectories that passes through these grid cells. Each trajectory is represented by a sequence of numbers (that are grid cells through which the trajectory passes through).
  
  I want to solve the problem of **trajectory prediction** by giving the partial trajectory as input and predict the full trajectory. This becomes a sequence to sequence problem, where all sequences are integer values by default.
  
  I am trying to solve this problem through encoder-decoder LSTM architecture. Most tutorials/examples regarding sequence to sequence on net are on machine translations in which vocabularies or characters are **one-hot-encoded** to represent the text as integer values. When I hot-encode my sequence values the one-hot vector becomes very large because there are (30x35)k grid cells, the program has given memory overflow error (because each vector has of size 1 million).
  
  I am confused here, do I need to treat grid identity as categorical variable? because all grid identities are numeric numbers but these identities are not comparable (like prices).
  
  Do I need to hot-encode my integer values in my sequence? Or is there any other alternative to solve this problem? I also appreciate if you suggest me the **similar tutorials** having the sequence to sequence prediction problem.
  
  **Tags:** deep-learning, keras, long-short-term-memory
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-15. Score: 0
  
  One hot encoding helps a lot. You can actually one hot encode each batch just before the training to reduce memory usage. One hot encoding makes the input data more intuitive for the network as a numeric value requires the network to do multiple comparisons to understand the value. For examples please tell me which deep learning framework you are using so I can give you some links or code. Hope I can help you.
  
  > **Comments:**
  > **username_0**: I am trying to solve using encoder-decoder LSTM. especially I also need the   intuition/concept of onehot batch encoding, how it works?  
  > **username_1**: What do you mean by one hot batch encoding? Thanks @username_0  
  > **username_0**: The statement in your answer "You can actually one hot encode each batch just before the training to reduce memory usage.". how to do this  
  
  ---
  
  