Why a Model with No Predictive Power Can Score 90% Accuracy
Summary
The article demonstrates how look-ahead bias can inflate model accuracy, specifically when outcome variables span multiple future observations and overlap between training and test sets. It simulates a market with no predictive edge, where daily returns are independently drawn from a bell curve centered on zero. A model predicting 20-day cumulative returns achieves 90.5% accuracy using a one-nearest-neighbor classifier and walk-forward validation with no gap. This inflated score arises because neighboring training and test labels share 19 of 20 underlying returns, leading to 91% agreement between adjacent labels. Applying a "purging" fix by introducing a 20-day gap between training and test sets in TimeSeriesSplit eliminates this overlap, reducing accuracy to 50.3%, which aligns with the expected 50% for data with no signal. The article highlights that this 40.2 percentage point overstatement is due to leakage.
Key takeaway
For Machine Learning Engineers building time-series models, if your outcome variable spans multiple future observations, you must implement purged cross-validation. Failing to introduce a sufficient gap between training and test sets will lead to look-ahead bias, artificially inflating your model's reported accuracy by potentially over 40 percentage points. Ensure your validation strategy prevents any training label from reaching into the test period to avoid deploying models that appear performant but lack true predictive power.
Key insights
Look-ahead bias from overlapping outcome windows can inflate model accuracy significantly, even with no predictive power.
Principles
- Outcome variables spanning future observations can create look-ahead bias.
- Neighboring time-series labels often share underlying data, leading to high agreement.
- Measured accuracy can be inflated by 40+ percentage points due to label overlap.
Method
To prevent look-ahead bias from overlapping outcome windows, introduce a "purging" gap (equal to the outcome horizon) between training and test sets in walk-forward validation.
In practice
- Use TimeSeriesSplit with a gap parameter.
- Set gap to the outcome horizon (e.g., 20 days).
- For variable horizons, apply exact purging.
Topics
- Look-ahead Bias
- Time Series Validation
- Purged Cross-Validation
- Model Accuracy
- Financial Machine Learning
- TimeSeriesSplit
Best for: Machine Learning Engineer, Data Scientist
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by Towards AI - Medium.