Rolling cross-validation evaluates time-series models by moving nonrandom training and validation windows forward through timestamps. Training always uses the past to predict a later period, avoiding future-to-past leakage. section 7.2.4
Configure each rolling split around the way the model will operate in production:
- Match the validation-window size to the forecast horizon and the time the model will run before retraining. section 7.2.4
- Choose either all available history or a limited recent window, depending on whether older patterns remain relevant. section 7.2.4
- Align training and validation windows with seasonality; yearly patterns may require at least two years, while weekly folds should contain matching weekdays. section 7.2.4
- Insert a gap when data arrives late or when reducing correlation between training and validation observations helps limit leakage. section 7.2.4
Retail demand forecasting
A demand model predicts four weeks ahead using five outer rolling folds. Each fold trains on two years, validates on 28 days, leaves a three-day gap, and advances seven days. A three-fold inner rolling loop tunes hyperparameters and selects features inside each outer training set. section 7.5.1
Figure 7.4 Standard time-based split. The test dataset always follows the train one, so train samples are “past” and test is “future.”
Use the time-based split diagram to anchor the central rule: every test period follows its training period in time. section 7.2.4
