Random K-fold lets training observe periods that occur after validation. Time-aware splits — expanding window, sliding window, or blocked holdout with a gap — respect the information available at prediction time.
TL;DR: The principle is simple and non-negotiable — train on the past, validate on the future. Expanding, sliding, and blocked-holdout splits all respect time; the choice depends on how quickly the process changes and what information is truly available at prediction time. And if a forecasting score looks suspiciously strong, do not inspect the model first. Inspect the split.
Random K-fold cross-validation is wrong for time series — not because cross-validation itself is wrong, but because random folds can let training observe periods that occur after the periods used for validation. That creates an evaluation environment you would never have in production, and it produces overly optimistic scores, misleading model comparisons, and false confidence before deployment. Validation must respect the information available at prediction time.
Three common time-aware patterns solve different operational problems, so I choose between them rather than defaulting to one:
Train on all available history, then test on the next period. Useful when older observations remain relevant and the process is reasonably stable.
Train on a fixed recent window, then move both training and testing periods forward. Useful when the process changes over time and older history becomes less representative.
Leave a gap between training and test when overlapping labels, rolling features, delayed data availability, or forecast horizons could otherwise leak information. A gap is not automatically required — it is a control to use when the data-generating process and feature construction justify it.
The correct split depends on the operational question: What forecast horizon matters? How often is the model retrained? What data is actually available at prediction time? Do labels or features arrive with delay? Does the model use overlapping windows?
Deriving the split from the deployment reality — forecast horizon, retraining cadence, data available at prediction time, and whether labels, features, or windows overlap — kept only evaluations that translate to production. Time-aware validation turned a suspiciously strong score into an honest one, and honest scores into decisions that survived contact with production.
Design insight: The principle is simple and non-negotiable — train on the past, validate on the future. Expanding, sliding, and blocked-holdout splits all respect time; the choice depends on how quickly the process changes and what information is truly available at prediction time. And if a forecasting score looks suspiciously strong, do not inspect the model first. Inspect the split.
The principle is simple and non-negotiable — train on the past, validate on the future. Expanding, sliding, and blocked-holdout splits all respect time; the choice depends on how quickly the process changes and what information is truly available at prediction time. And if a forecasting score looks suspiciously strong, do not inspect the model first. Inspect the split.
This was written by Mahmoud Trigui, Senior Data Scientist. Random K-fold leaks future periods into training and inflates scores. Use time-aware splits (expanding, sliding, blocked holdout) and validate on the future.