I have read a lot of discussion on how to do cross-validation on time series data (e.g. walk forward) but I failed to understand how to properly prepare the training data for multiple time series forecast, especially with deep learning models like RNN which require training with the whole dataset more than once (epochs >1).

Let's assume I have a dataset with 3-year sales data for different products. I am going to use an RNN (or LSTM/GRU) with encoder-decoder architecture to predict future 10 days sales.


3 x 365 data point for each product (here assume we have only 3)

Product A: a1, a2, a3, ..., a1095
Product B: b1, b2, b3, ..., b1095
Product C: c1, c2, c3, ..., c1095


Say I want to use a sliding window of 60 to predict the next 10 days sales. I could transform the data like these:

Input sales, Target

[a1, a2, ..., a60], [a61, a62, ..., a70]
[a2, a3, ..., a61], [a62, a63, ..., a71]
[b1, b2, ..., b60], [b61, b62, ..., b70]
[c1, c2, ..., c60], [c61, c62, ..., c70]

And my model will look like this:

enter image description here

with mini-batch >1 and epochs >1


I want to hold out 1 year of data for testing. so training data will include sales from 0 to 730.

  1. Since each input of same product (e.g. [a1, a2, ..., a60] & [a2, a3, ..., a61]) are highly correlated, is it bad that I have [a1, a2, ..., a60] & [a2, a3, ..., a61] in same mini-batch?

  2. Are sales sequence from different products independent? (so I could have [b1, b2, ..., b60] & [a1, a2, ..., a60] in same mini-batch.)

  3. Most of the example I found use ARIMA model, which only fit the data once to train the model. Hence it makes sense to me to use validation techniques like Walk-forward. What about in RNN setting when I need to fit the same data multiple time to the model?

  4. How should I properly validate the model with the 1-year hold out data? Should I use walk-forward validation?

TLDR: What should the training data look like when using RNN for multi-steps & multiple time series forecast?


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.