Say I have a time series data set of 100 sequential timesteps, and I want to train and test an LSTM on the data set, but only on forecasting a single timestep into the future.

I want more than one prediction to evaluate the model's performance, so instead of using the first 99 data points for training and just the 100th one for testing, I will instead take the first, say, 80 data points as the training set and then test the model's performance on the final 20.

To do so, can I train on the first 80 alone, and then pass in the first 81, and use the 81st prediction as the first of my test set, then use the first 82 as input, and record the test prediction, and repeat this 20 times until I have the final prediction for the 100th data point, where I can then evaluate the accuracy on these final 20 unseen data points.

Otherwise, by the nature of how an LSTM works, can I train on the first 80 data points, and then pass in the full length 100 sequence and use the predictions at timesteps 81 - 100 as the test set predictions? In other words, with this method, is each prediction at every timestep a single timestep prediction based on all input data points up to this timestep? Or would the 100th timestep be more like a forecast 20 timepoints into the future?


My understanding is that your test and training sets should be completely separate if you want an accurate evaluation of performance.

If you train on the first 80 time points, they shouldn't be used as inputs when testing the next 20.

That is, the inputs for your testing should not have been used as inputs during training.


Your Answer

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

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