How does time-based leakage happen and how do you prevent it?
hardAnswer
- (1) Using future timestamps in features (fitting on aggregate features computed with post-event data).
- (2) Random shuffle instead of time-based split.
- (3) Target encoding across time (using future target information).
- Fix: (1) time-based split (train ← past, test ← future).
- (2) Purged CV with embargo (gap between train/test to avoid autocorrelation).
- (3) Feature engineering only uses features known BEFORE prediction time (as-of-timestamps in feature store).
- (4) Backtesting with rolling / expanding windows.
Check yourself — multiple choice
- Random
- Future info in features / random shuffle / target encoding across time; fix via time-based split + purged CV with embargo + as-of-timestamps + rolling backtest
- Not real
- Same as leakage
Time leakage: split by time + purged CV + as-of features + backtest.
#data-quality#pipeline
Practise MLOps & Data Quality
215 interview questions in this topic.