Basic Prerequisites: 04 · Combinatorial Purged CV and 05 · Failure Modes.
1. Intuition & Practical Objective
The basic hygiene stack (purge + embargo + CPCV) is complete in the small; this page is the launchpad for the two questions practitioners actually argue about: (1) why is walk-forward the wrong default? and (2) how do I do honest hyperparameter selection and final performance reporting under CPCV? Both reduce to the same root idea - every measurement you report must be a statement about a distribution, not a single historical draw - and both connect to the Deflated Sharpe Ratio for the final yes/no on “is this real?“
2. Mathematical Ground Truth & Derivations
2.1 Why walk-forward is a weak default (AFML §12.2)
Walk-forward (WF) trains on a trailing window and forecasts the next block, which sounds maximally realistic. López de Prado lists three structural flaws:
- It overfits the sequence, not the signal. Reversing the data (walk-backward) yields a different, equally “overfit” backtest; if WF were honest, walk-backward would systematically underperform - it does not, which shows WF is selecting on the historical ordering (AFML §12.2).
- It is regime-dependent. The training window fixes the mixture of regimes (a rally-then-selloff vs selloff-then-rally span the same sample in two orders and train two very different strategies).
- Decisions use unequal data. With a warm-up of observations, decision (for ) trains on points, so early decisions run on far less data than late ones:
The first half of decisions use only a small fraction of the sample, so a few early observations carry disproportionate weight on the final Sharpe - inflating its variance (AFML §12.2, §12.5).
2.2 CPCV variance and the deflated decision
CPCV’s answer is a -path Sharpe distribution with sample-mean variance (AFML §12.5)
The Deflated Sharpe Ratio (DSR, Backtesting Hygiene) then answers the final question: is the CPCV mean Sharpe distinguishable from the best of trials of a null strategy, after correcting for non-normality? Purging fixes leakage; CPCV fixes single-path variance; DSR fixes selection bias. They are three orthogonal costs of overfitting, and a defensible pipeline pays all three.
2.3 Hyperparameter tuning under CPCV
Tuning a hyperparameter grid inside each CPCV fold is the correct pattern: for every train/test split, run an inner CV on the train side to pick the hyperparameters, then score the held-out test groups. This mirrors ESL §7.10.2’s “screening must happen inside each fold” and keeps the outer CPCV estimate honest. López de Prado’s Machine Learning for Asset Managers (Ch. 7) gives this as the standard tuning recipe for quant pipelines.
3. Computational Implementation - walk-forward’s unequal data + the CPCV variance
Stdlib only.
A. Walk-forward warm-up: how few data the early decisions see. T=100, three warm-up lengths:
Even with a modest warm-up, the early decisions run on points while the late ones use ~100 - so the Sharpe is a weighted average of very unequally-informed bets. That variance is what CPCV removes by training every combination on equal, large fractions.
B. CPCV variance table - the decision tool. Choose given your path correlation :
Read it as the design trade-off: with independent paths () even crushes variance to ; with highly correlated paths () CPCV is nearly useless (variance barely falls below ) - so the quality of paths (low overlap, ) matters more than their sheer number.
4. Failure Modes & First-Principles Breakdowns
- Believing a single backtest number. WF and plain CV return the maximum-variance estimate available (var ). Report the CPCV distribution and deflate the mean by trials.
- Tuning hyperparameters on the outer split. Selecting hyperparameters against the same data you then score on is the ESL §7.10.2 sin at the CPCV scale - it reinflates the estimate. Tune inside each fold only.
- Reversing the hygiene and the deflation. Purging, CPCV, and DSR attack three different overfitting mechanisms. Using CPCV alone (no DSR) still selects on trials; using DSR alone (no purging) still leaks labels. The stack, not any one tool, is the answer.
5. References
- López de Prado, Advances in Financial Machine Learning, Ch. 12 (§12.2 walk-forward flaws
- López de Prado, Machine Learning for Asset Managers (2020), Ch. 7
- “Backtest Overfitting in the Machine Learning Era” (Expert Systems with Applications, 2025)
- Bailey & López de Prado, The Deflated Sharpe Ratio, J. Portfolio Management 40(5) (2014)
- Hastie, Tibshirani & Friedman, The Elements of Statistical Learning, Ch. 7 (§7.10.2 screening inside folds).
6. Connected Graph Bridges
- Back: 05 · Failure Modes · Index Hub
- Deflation & PBO: Backtesting Hygiene
- Applied in a real pipeline: Tree-Based Factor Ranking & Purged CV · Financial ML Pitfalls & Low SNR