What is data leakage and how do you prevent it in time-series?medium

Type
scenario
Topic
is-data-leakage-and-how-do-you-prevent-it-in-time-series
Frequency
common
Tags
machine-learning, what, data, leakage, and, how
Answer

Leakage is when future information bleeds into training, inflating metrics.

Explanation

Leakage is when future information bleeds into training, inflating metrics. Prevention: strict temporal splits (TimeSeriesSplit, no shuffle), lag features only from t-n onwards, rolling stats computed on training window only, careful with target encoding. Always verify that your validation set strictly follows your training set in time.

Follow-upCan you give a production example?