Say I am doing a time series prediction which predict some value for next time step with past T inputs from historical inputs. Say I am using a RNN module like LSTM or GRU.

In trainning/validation, I fed RNN module with batches of shape (batch_size, T, *) data to train a model.

When inferencing, I can either:

  1. Always use past T inputs to get next step prediction, then discard the state of the RNN module. That is: use input from time -T to -1 to get prediction at t=0 (last output of LSTM or GRU module), then discard the final state of the RNN module and use input from time -T+1 to 0 to get prediction at t=1 etc.
  2. keep the RNN state, and each time feed only one input to get the prediction. That is: first use input from time -T to -1 to get prediction at t=1 like above. Then keep the current state of the RNN and feed the RNN with input at t=1 to get the prediction at t=2 etc.

Which one is better? Or It depends on specific problems? Thanks


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.