Why should random train/test splits not be used for time-series data?

Quick Overview

Asks why shuffling time-series data into random train and test sets gives misleading results, and what validation scheme to use instead. Tests understanding of temporal leakage, autocorrelation, and evaluation that mirrors how a forecasting model is deployed.

Why should random train/test splits not be used for time-series data?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Why should random train/test splits not be used for time-series data? Explain what goes wrong and what you would use instead. ```hint Look at a test point's neighbors After a random shuffle, ask where the observations just before and just after a test point end up, and how similar they are to it. ``` ### What a Strong Answer Covers - Why autocorrelation lets a random split leak information from the future into training - How lag and rolling-window features can carry future values across the split - Why evaluation should mirror deployment, including what a random split hides about drift - Chronological holdout and walk-forward validation as alternatives - When and why to add a gap (embargo) between training and test data ### Follow-up Questions - How would you choose the size of the gap between the training and test blocks? - When would you prefer an expanding window over a sliding window for walk-forward validation? - If you have many separate series, one per store, is splitting randomly by store enough? What leakage can remain? - How would you tune hyperparameters without leaking information from the final test period?

Overview: Asks why shuffling time-series data into random train and test sets gives misleading results, and what validation scheme to use instead. Tests understanding of temporal leakage, autocorrelation, and evaluation that mirrors how a forecasting model is deployed.

PracHub logo
General
Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

Why should random train/test splits not be used for time-series data? Explain what goes wrong and what you would use instead.

What a Strong Answer Covers Guidance

  • Why autocorrelation lets a random split leak information from the future into training
  • How lag and rolling-window features can carry future values across the split
  • Why evaluation should mirror deployment, including what a random split hides about drift
  • Chronological holdout and walk-forward validation as alternatives
  • When and why to add a gap (embargo) between training and test data

Follow-up Questions Guidance

  • How would you choose the size of the gap between the training and test blocks?
  • When would you prefer an expanding window over a sliding window for walk-forward validation?
  • If you have many separate series, one per store, is splitting randomly by store enough? What leakage can remain?
  • How would you tune hyperparameters without leaking information from the final test period?