I roughly understand what return_sequences=True does when being used for time series prediction with RNN (each RNN cell outputs its hidden state). Now my question is it always advisable to use return_sequences=True for a conventional RNN or a LSTM? What are the pros and cons of using it?

Reminder: Would anybody mind sharing his/her experience on that topic. Do you usually use it or not? I'll appreciate every comment.

  • 1
    $\begingroup$ Using return_sequences=True is a matter of whether in your specific problem you need the whole sequence of predictions or just the final step, not something beneficial. $\endgroup$
    – noe
    Sep 17 at 14:15
  • $\begingroup$ I agree with @noe. From limited personal experience, return the sequences when you want to use further RNN/LSTM layers, but drop down to a single output before moving on to dense layers. $\endgroup$ Sep 17 at 14:50
  • $\begingroup$ Thanks all for your answer. To be totally honest I have to admit that I do not really undestand it. As far as I understand return_sequence= True returns the sequence for every note of the RNN/LSTM and thus you have more training data to learn the mapping between inputs and outputs. You also have to adjust the training data if return_sequence =True to have more samples for the input output mapping of a neural network. $\endgroup$
    – PeterBe
    Sep 17 at 15:11
  • $\begingroup$ @noe: Any comments to my last comment. I'll highly appreciate every further comment from you. $\endgroup$
    – PeterBe
    Sep 20 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.