Combinatorial Purged Cross-Validation (CPCV) Calculator

CPCV replaces one validation path with a family of leakage-aware train/test combinations. Enter the number of ordered time groups and the number held out per split to see how quickly the design expands.
6 groups, 1 held out6 train/test splits; 1 complete backtest path
6 groups, 2 held out15 train/test splits; 5 complete backtest paths

CPCV design

Use 2–30 ordered groups and hold out at least 1 but no more than half the groups per split. This calculator covers CPCV design combinatorics, not row-level purge or embargo sizing.

Validation design

15Train/test simulations = C(N, k)
5Complete backtest paths = C(N - 1, k - 1)
5Test appearances for every time group
66.7%Groups available for training before purge/embargo removals

Why CPCV creates more than one backtest path

Walk-forward and one-group-at-a-time validation produce a narrow view of historical path dependence. CPCV divides history into ordered groups and evaluates every combination of k held-out groups. That creates C(N,k) train/test simulations.

Each group appears in C(N-1,k-1) test simulations. Those test appearances can be recombined so every complete path contains one out-of-sample realization for every group. The number of complete paths is therefore C(N-1,k-1), equivalently (k/N) × C(N,k).

For the canonical N=6, k=2 example, CPCV creates 15 train/test simulations and 5 complete backtest paths. Each of the six groups appears as test data exactly five times.

CPCV does not replace purging and embargo

The combinatorics only determine which groups are assigned to train and test for each simulation. Financial labels can still overlap across those boundaries. Every split must still remove training observations whose information intervals overlap test information, and an additional embargo may be appropriate.

Use the Purged Cross-Validation calculator for the row-level overlap geometry. This calculator keeps group-combination design separate from purge and embargo mechanics.

What this calculator does not prove

More paths do not manufacture more independent market history. CPCV reuses the same observations in structured combinations, so the resulting path metrics are dependent. A large path count is not a significance level, an effective sample size, or evidence that a strategy will survive live trading.

The calculator also does not choose the right number of groups, test groups, label horizon, or embargo for a strategy. Those are research-design choices tied to the data-generating process and holding period.

For CSCV-based diagnostics of selection-process overfitting across a strategy matrix, use the Probability of Backtest Overfitting calculator. This page focuses on CPCV validation design and the number of out-of-sample paths it can generate.

Reusable CPCV design grid

The downloadable grid covers N values of 6, 8, 10, and 12 with one, two, or three held-out groups where valid. It reports split count, full path count, test appearances per group, and train/test fractions.

Download CSV · Download JSON

Method references

  • Marcos López de Prado, Advances in Financial Machine Learning, 2018, Chapter 12. CPCV partitions ordered observations into groups, evaluates combinations of held-out groups, and reconstructs multiple out-of-sample backtest paths.
  • RiskLab AI, Backtesting through Cross-Validation. The method summary gives the same path-count identity used here: φ(N,k) = (k/N) × C(N,k).