Answers.Body: <p>You should try an architecture with an <strong>encoder</strong> and a <strong>decoder</strong>. The encoder will consume all the data you give as in put and decoder will give out the series of output.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-01T10:08:38.370Z
Answers.LastActivityDate: 2020-06-01T10:08:38.370Z
Answers.UserDisplayName: San
Answers.Body: <p>These are some links that might be useful with some code, considering an LSTM Encoder-Decoder architecture.</p>
  <ol>
  <li><p><a href="https://www.analyticsvidhya.com/blog/2020/08/a-simple-introduction-to-sequence-to-sequence-models/" rel="nofollow noreferrer"><strong>A Simple Introduction to Sequence to Sequence Models</strong></a></p>
  </li>
  <li><p><a href="https://www.pluralsight.com/guides/nmt:-encoder-and-decoder-with-keras" rel="nofollow noreferrer"><strong>NMT: Encoder and Decoder with Keras</strong></a></p>
  </li>
  <li><p><a href="https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html" rel="nofollow noreferrer"><strong>A ten-minute introduction to sequence-to-sequence learning in Keras</strong></a></p>
  </li>
  <li><p><a href="https://machinelearningmastery.com/develop-encoder-decoder-model-sequence-sequence-prediction-keras/" rel="nofollow noreferrer"><strong>How to Develop an Encoder-Decoder Model for Sequence-to-Sequence Prediction in Keras</strong></a></p>
  </li>
  <li><p><a href="https://towardsdatascience.com/how-to-build-an-encoder-decoder-translation-model-using-lstm-with-python-and-keras-a31e9d864b9b" rel="nofollow noreferrer"><strong>How to build an encoder decoder translation model using LSTM with Python and Keras</strong></a></p>
  </li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-04T13:04:30.770Z
Answers.LastActivityDate: 2022-03-06T15:54:16.960Z
Answers.LastEditDate: 2022-03-06T15:54:16.960Z
Answers.UserDisplayName: atmp
Body: <p>I am learning to use a LSTM model to predict time series data. Specifically, I hope the network should output a sequence (with multiple time steps) only after the input sequence has finished feeding in, as shown in the left figure.</p>
  
  <p><a href="https://i.sstatic.net/mnD8D.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mnD8D.png" alt="enter image description here"></a></p>
  
  <p>However, most of the LSTM sequence-to-sequence prediction tutorial I have read seems to be the right figure (i.e. each time step of the output sequence is generated after each time step of the input sequence). What's more, as far as I understand, the LSTM implementation in PyTorch (and probably Keras) can only return output sequence corresponding to each time step of the input sequence. It cannot make predictions after the input sequence is over. </p>
  
  <p>I hope to know is there any way to make a sequence-to-sequence LSTM network which starts output only after the input sequence has finished feeding in? And it would be better if someone can show me an example implementation code.</p>
  
Tags: <recurrent-neural-networks><long-short-term-memory>
Title: How to make a LSTM network to predict sequence only after input sequence is finished?
UserDisplayName: Cloudy
ThreadText: # How to make a LSTM network to predict sequence only after input sequence is finished?
  
  (Asked by: username_0 on 2020-05-31)
  
  I am learning to use a LSTM model to predict time series data. Specifically, I hope the network should output a sequence (with multiple time steps) only after the input sequence has finished feeding in, as shown in the left figure.
  
  [![enter image description here](https://i.sstatic.net/mnD8D.png)](https://i.sstatic.net/mnD8D.png)
  
  However, most of the LSTM sequence-to-sequence prediction tutorial I have read seems to be the right figure (i.e. each time step of the output sequence is generated after each time step of the input sequence). What's more, as far as I understand, the LSTM implementation in PyTorch (and probably Keras) can only return output sequence corresponding to each time step of the input sequence. It cannot make predictions after the input sequence is over.
  
  I hope to know is there any way to make a sequence-to-sequence LSTM network which starts output only after the input sequence has finished feeding in? And it would be better if someone can show me an example implementation code.
  
  **Tags:** recurrent-neural-networks, long-short-term-memory
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-06-01. Score: 1
  
  You should try an architecture with an **encoder** and a **decoder**. The encoder will consume all the data you give as in put and decoder will give out the series of output.
  
  
  ---
  
  ### Answer by username_2 on 2022-03-04. Score: 0
  
  These are some links that might be useful with some code, considering an LSTM Encoder-Decoder architecture.
  
  1. [**A Simple Introduction to Sequence to Sequence Models**](https://www.analyticsvidhya.com/blog/2020/08/a-simple-introduction-to-sequence-to-sequence-models/)
  2. [**NMT: Encoder and Decoder with Keras**](https://www.pluralsight.com/guides/nmt:-encoder-and-decoder-with-keras)
  3. [**A ten-minute introduction to sequence-to-sequence learning in Keras**](https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html)
  4. [**How to Develop an Encoder-Decoder Model for Sequence-to-Sequence Prediction in Keras**](https://machinelearningmastery.com/develop-encoder-decoder-model-sequence-sequence-prediction-keras/)
  5. [**How to build an encoder decoder translation model using LSTM with Python and Keras**](https://towardsdatascience.com/how-to-build-an-encoder-decoder-translation-model-using-lstm-with-python-and-keras-a31e9d864b9b)
  
  
  ---
  
  