Why K-Fold Cross-Validation Fails for Trading Models and How to Fix It
Standard k-fold cross-validation silently overfits financial machine learning models by shuffling time-series data, allowing future information to leak into training rows. Because labels often look several bars ahead, a nearby training sample can inadvertently 'know' part of the future, inflating training accuracy while test performance stays flat. The recommended fix involves two steps: purging any training row whose label window overlaps the test window, and embargoing additional bars after each test window to prevent adjacent data from bleeding across splits. A short Python function implementing this purged-and-embargoed split is presented as a drop-in replacement for standard cross-validators. The author also warns that hyperparameter tuners like Optuna can appear to win validation sets based on statistically insignificant sample sizes, urging practitioners to log all train-validation-test gaps rather than only the winning trial's score.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in