How do you set up cross-validation for time series?
hardAnswer
- Never random splits — that leaks future info into training.
- Options: (1) walk-forward / rolling-origin: expand or slide a training window and evaluate on the next block.
- (2) blocked / purged k-fold: keep folds contiguous in time and add a purge gap between train and validation to remove any labeled points near the boundary.
- (3) time-series split with combinatorial purging + embargoes (Lopez de Prado) for financial data with overlapping labels.
- Always check the last training timestamp precedes the first validation timestamp.
Check yourself — multiple choice
- Random shuffled k-fold
- Walk-forward / blocked / purged splits — respect time order, add gaps to prevent leakage
- Only LOOCV works
- Time series doesn't need CV
Walk-forward + purge/embargo blocks — never shuffle time-series data.
#cv#validation#time-series
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- Leave-One-Out CV — when is it a good idea, and when is it a bad idea?
- What is nested cross-validation and when do you need it?
- Why would you use repeated k-fold instead of standard k-fold?
- How do you pick the train/validation/test split sizes?
- How does cross-validation change for heavily imbalanced classification?
- You use stratified k-fold on a dataset with duplicate customer records — why is it wrong?