1
$\begingroup$

Knowing the nature of my time series problem, I am using a stateful LSTM to forecast one step ahead.

My question is quite straightforward.

Do I need to explicitly save and pass the hidden cell in every prediction step in deployment, or Keras model already saves, updates and uses the states between predictions, and what I will do is simply predict as new data arrives?

Thanks in advance.

$\endgroup$

1 Answer 1

1
$\begingroup$

I think the Keras documentation gives a good explanation

stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.

In other words, when stateful=True, Keras saves the state between batches so that you don't have to.

This blog post has more details. http://philipperemy.github.io/keras-stateful-lstm/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.