I am trying to make an LSTM for time series prediction in Keras. In particular, it should predict unseen values once the model is trained. A visualisation of the time series is shown below.
The model is trained on the blue time series, and predictions are compared to the orange time series.
For predicting, I want to take the last n points of the training data (where n is the sequence length), run a prediction, and use this prediction for a consecutive (second) prediction, ie:
prediction(t+1) = model(obs(t-1), obs(t-2), ..., obs(t-n))
prediction(t+2) = model(prediction(t+1), obs(t-1), ..., obs(t-n))
I have tried to get this to work, but so far without success. I am at a loss if I should use a stateful or stateless model, and what a good value for the sequence length could be. Does anyone have experience with this?
I have read and tried various tutorials, but none seen to applicable to my kind of data.
Because I want to run consecutive predictions, I would need a stateful model to prevent keras resetting states after each call to model.predict, but training with a batch size of 1 takes forever... Or is there a way to circumvent this problem?