Combinatorial Purged Cross-Validation
A cross-validation scheme that reuses the same purged, embargoed data in many combinations to produce not one backtest path but a whole distribution of them, so you can measure how lucky your single equity curve was.
Prerequisites: Purged & Embargoed Cross-Validation, Cross-Validation for Time Series
A single backtest gives you a single equity curve, which is a single draw from a distribution you never get to see. Maybe the strategy is good; maybe that one path just happened to dodge the bad patches. Ordinary Walk-Forward Analysis testing suffers this badly: it produces exactly one out-of-sample path, so you can't tell skill from luck. Combinatorial Purged Cross-Validation (CPCV), from López de Prado, squeezes many out-of-sample paths out of the same data, turning your one equity curve into a whole distribution you can actually reason about.
The idea builds directly on Purged & Embargoed Cross-Validation: it keeps the purging (drop training labels whose forward windows overlap the test block) and the embargo (drop a buffer after it), then adds combinatorics on top.
How it works
Split the time series into equal, ordered groups. Instead of testing on one group at a time, test on every combination of groups at once, purging and embargoing each. There are such combinations. Because each combination leaves a different set of groups for testing, you can stitch the test predictions together into complete, start-to-finish backtest paths, and it turns out you get many of them. The number of distinct paths is
Here is how many groups you carve the timeline into, is how many you hold out for testing in each combination, and is " choose ", the count of ways to pick those groups. Each of the paths is a full equity curve built from models that never saw their own test data (thanks to purging and embargo), so you end up with Sharpe ratios instead of one.
CPCV tests on all combinations of held-out groups and reassembles them into full backtest paths. One equity curve becomes a distribution of equity curves, so you can measure the spread of your result, not just its center.
The table shows how quickly paths accumulate. Testing one group at a time () recovers plain k-fold and gives just one path; holding out two or more groups unlocks many.
| Groups | Held out | Combinations | Backtest paths |
|---|---|---|---|
| 6 | 1 | 6 | 1 |
| 6 | 2 | 15 | 5 |
| 10 | 2 | 45 | 9 |
| 10 | 5 | 252 | 126 |
A modest number of groups yields a rich set of backtest paths. With 6 groups holding out 2, the same data produces 15 train/test splits that reassemble into 5 full-length out-of-sample paths.
Worked example
Take groups and hold out at a time. There are ways to choose the test pair, so you train and evaluate models (each with the overlapping labels purged and a buffer embargoed). Those 15 splits recombine into complete backtest paths.
Now instead of one Sharpe you have five, say . Immediately you know things a single number could never tell you: the mean is about , but the spread runs from to . If your reported single-path Sharpe had been the , you'd now see it was the lucky top of the range, not typical. You can also count how often the strategy's in-sample best configuration underperforms out-of-sample across these paths, which is precisely the ingredient for estimating the probability of Backtest Overfitting.
Report the whole distribution of path Sharpes, its median and its spread, not the single best path. The gap between the best path and the median is a direct read on how much luck was in your headline number.
Pitfalls
- Paths are not independent. The paths share data and overlapping models, so their Sharpes are correlated. Treat the spread as an honest picture of variability, not as independent samples for a tight confidence interval.
- Purge and embargo still mandatory. CPCV without purging leaks exactly like naive k-fold; the combinatorics multiply the leakage rather than fixing it. See Purged & Embargoed Cross-Validation.
- Cost. You train models, which explodes for large and mid-range . Choose and for enough paths (a few dozen) without a runaway model count.
- Group size vs label span. Groups must be long relative to the label horizon from Triple-Barrier Labeling, or purging eats most of each fold.
More paths is not more data. CPCV reuses the same observations in different arrangements, so the paths are correlated. It reveals the variability of your backtest honestly, but it cannot manufacture statistical power you don't have, that still needs a longer sample.
In interviews
If asked "how do you know your backtest's Sharpe wasn't a fluke of one particular data path?", the strong answer is CPCV: partition into groups, test on all combinations with purging and embargo, and reassemble out-of-sample paths to get a distribution of Sharpes. Note that this distribution is what feeds the probability-of-backtest-overfitting estimate, and that the paths are correlated so you shouldn't oversell their precision.
Related concepts
Practice in interviews
Further reading
- López de Prado, Advances in Financial Machine Learning (Ch. 12)
- Bailey, Borwein, López de Prado & Zhu, The Probability of Backtest Overfitting