Back to Classic ML Mind Map
中文·English
📊 Classic MLID: timeseries-cv

Time-Series Cross-Validation

时序交叉验证
🎯Core Definition
Time-series data cannot use random K-Fold; walk-forward (rolling-window) validation must be used instead: the training set contains only past time steps and the validation set is the immediately following future window — step 1 trains on [0,t][0, t] and validates on [t,t+h][t, t+h], step 2 rolls to train on [0,t+s][0, t+s] and validate on [t+s,t+s+h][t+s, t+s+h], and so on until the data is covered. The iron rule is no future information: any preprocessing computed with future statistics (means, targets, global normalization parameters) causes temporal leakage and inflates validation scores. For hyperparameter tuning, nested CV is used: an outer rolling loop for model evaluation and an inner loop for hyperparameter search, avoiding selection bias.
💡Use Cases
forecasting stocks/sales/traffic, risk control and recommendation — anything with timestamps; interviews ask “how to CV time series”, “why random K-Fold overestimates”, and “which future information must be blocked”.
Key Problems Solved
random K-Fold mixes future samples into training so the model “peeks” into the future, inflating CV scores that collapse in production; walk-forward mimics the real online setting (every step predicts using only history) and gives an honest generalization estimate — it sacrifices some training data (early windows are small) in exchange for temporal integrity that matches deployment.
🎯5 High-Frequency Exam Points
1
Why does random K-Fold fail on time series? Trace the concrete leakage path (e.g. predicting t+1 with samples from t+1 onward)?
2
Describe the walk-forward rolling-window procedure: training span, validation span and step size for step k?
3
How to normalize, impute and target-encode in time-series modeling without leakage (history-only statistics)?
4
What is nested CV? What does each loop do, and which bias does it fix?
5
How does walk-forward differ from plain K-Fold in bias-variance and cost? When is the data loss acceptable?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Time-Series Cross-Validation"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardK-Fold Cross-ValidationNext CardClass Imbalance

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient