I trained a time series model with LSTM (Shape is N, 20, 1).
Suppose N
is the last data.
Using model.predict
gives the N + 1
th predicted value.
How do I predict data values after N + 2, N + 3, N + 4 .... etc.
In a time series model like LSTM, predicting a new datapoint depends on the previous datapoints. To predict n + 1, you use [N-19...N]. Now to predict n + 2, you need [N-18...N+1]. Repeat this process if you want to predict farther and farther in the future.
Of course, the farther ahead you go, the less accurate your predictions will be. RNNs are good at predicting the next timestep, but not so good at predicting things far in the future. That's why if you look at books or sentences generated by neural nets, they don't make much sense.
Once you have the real value for n + 1, the n + 2 prediction will be more accurate than if you had to use your predicted value.