Purged Cross-Validation Explained: Why Shuffled K-Fold Leaks in Stock Research, and How Purging and Embargo Fix It
November 9, 2026 · Guides · 9 min read
Published by Chris Leek, founder of Equity Rank
Purged Cross-Validation Explained: Why Shuffled K-Fold Leaks in Stock Research, and How Purging and Embargo Fix It
Cross-validation is the standard way to measure a model on data it was not trained on. Split the history into k folds, train on all but one, measure on the one left out, and repeat until every fold has been the test set once.
The method assumes the observations are independent. Daily stock research usually breaks that assumption, and when it does, ordinary cross-validation measures skill that is not there. This guide explains why, and how two adjustments — purging and an embargo — restore an honest measurement.
Where the leak comes from
Most stock signals are judged against a forward return: the return over the next month, or the next quarter, from each scoring date. Score every trading day and the labels overlap heavily.
- The 21-day forward return measured from Monday and the one measured from Tuesday share 20 of their 21 trading days.
- A 63-day (quarterly) label shares 62 of 63 days with its neighbour.
Most useful features are also persistent: a valuation ratio, a quality score or a slow-moving trend changes little from one day to the next.
Put those two facts together. Tuesday's features look almost exactly like Monday's, and Tuesday's answer is almost exactly Monday's answer. If Monday sits in the training set and Tuesday in the test set, a flexible model can look up Monday and "predict" Tuesday nearly perfectly — without having learned anything about future returns. (The same overlap also inflates t-statistics; see Overlapping Returns and Newey-West.)
Three ways to split the history
| Method | How the folds are formed | Leak |
|---|---|---|
| Shuffled k-fold | Days assigned to folds at random | Severe: almost every test day has a training neighbour sharing most of its label |
| Blocked k-fold | Folds are contiguous stretches of time | Smaller: only at the edges of each block |
| Purged k-fold | Blocked, then any training day whose label window overlaps the test block's label windows is removed | Label overlap removed |
An embargo goes one step further: after purging, it also drops a short stretch of training days immediately after each test block, in case information from the test period carries forward into later observations.
A simulation: a signal with no skill
To measure the size of the leak, a seeded simulation (seed 20261109) built 300 hypothetical histories, each 2,520 trading days long (about ten years). Each day had a persistent feature (day-to-day autocorrelation 0.999) and an independent daily return. The feature had no relationship to future returns at all: the true information coefficient is zero.
A flexible model (5-nearest-neighbour regression) was fitted to predict the forward return from the feature, and its skill was measured as the information coefficient (IC) — the correlation between predicted and realised forward returns (see The Information Coefficient Explained). Each validation method was compared with a genuine holdout: the model trained on the full ten years and tested on the following three years, after a gap at least as long as the label.
21-day forward returns, 5 folds
| Validation method | Average IC | Histories with IC above 0.05 |
|---|---|---|
| Shuffled k-fold | 0.150 | 95% |
| Blocked k-fold | −0.002 | 20% |
| Purged k-fold | −0.003 | 19% |
| Purged k-fold + embargo | −0.001 | 22% |
| Future holdout (true out-of-sample) | 0.009 | 33% |
63-day forward returns, 20 folds
| Validation method | Average IC | Histories with IC above 0.05 |
|---|---|---|
| Shuffled k-fold | 0.248 | 100% |
| Blocked k-fold | 0.022 | 34% |
| Purged k-fold | 0.003 | 25% |
| Purged k-fold + embargo | 0.004 | 24% |
| Future holdout (true out-of-sample) | 0.004 | 36% |
Embargo of 25 trading days. All figures are hypothetical outputs of the stated simulation, not results of any real strategy or of Equity Rank output.
What the tables show:
- Shuffled k-fold manufactures skill from nothing. A feature with zero predictive power scored an average IC of 0.15 on monthly labels and 0.25 on quarterly ones, above 0.05 in 95–100% of histories. In practice an IC of 0.05 is often treated as meaningful; these numbers are several times that, and entirely leakage.
- Blocking removes most of the leak, but not all of it. With five long folds and monthly labels the edges are a small share of each block, and blocked and purged results are indistinguishable. With twenty short folds and quarterly labels, the edges are a large share of each block: blocked k-fold still reported a spurious IC of 0.022, and purging brought it down to 0.003.
- The leak grows with the label length and the number of folds. Longer labels overlap more days; more folds create more edges. Both are common choices in practice.
- The embargo changed little here — by design of this simulation. The feature did not use any data from inside the test block, so there was nothing for an embargo to catch. It earns its place when features are built from trailing windows (a 12-month momentum score computed just after a test block contains that block's returns) or when returns stay correlated beyond the label horizon.
- A single holdout is noisy. Even with zero true skill, about a third of the three-year holdouts produced an IC above 0.05. Honest validation removes the bias; it does not remove the sampling error.
With a small amount of real skill
The same simulation was repeated with a weak genuine link between the feature and future returns. On quarterly labels with 20 folds, the future holdout measured an average IC of 0.037. Shuffled k-fold reported 0.310 — more than eight times the holdout figure. Blocked k-fold reported 0.028 and purged k-fold 0.008. Purging erred on the cautious side here, partly because each cross-validation model trains on less data than the full-history holdout model; a method that understates a real effect is a far smaller problem than one that invents a large one.
Common mistakes
- Using a machine-learning library's default cross-validation. Many defaults shuffle, or split without regard to time. That is appropriate for independent observations and wrong for overlapping forward returns.
- Purging by the scoring date only. The overlap is in the label windows. A training day is contaminated if any day of its forward return falls inside the test block's label period.
- Forgetting features built from trailing windows. Those are what an embargo is for.
- Treating cross-validation as the final word. Every method above is still a test on the past. A live, frozen-in-advance track record remains the stronger evidence (see Minimum Track Record Length).
- Re-running the validation until it looks good. Trying many feature sets and reporting the best cross-validated one is multiple testing, whatever the splitting method (see Probability of Backtest Overfitting).
A checklist for reading a model-validation result
- How were the folds formed — shuffled, blocked, or purged?
- How long is the label, and was every training day whose label overlaps a test block removed?
- Do any features use trailing data that could include the test period, and was an embargo applied?
- How many folds, and how large is the gap between training and test data relative to the label length?
- Is there a genuine future holdout — and how wide is the uncertainty on it?
- How many model variations were tried before this one was reported?
The method behind purging and embargo is set out in Marcos López de Prado's Advances in Financial Machine Learning (2018), chapter 7. For the wider family of backtest errors, see Backtest Biases Explained.
This content is for educational and informational purposes only and does not constitute investment advice. Equity Rank is not a registered investment adviser. All signals, information coefficients and simulations in this article are hypothetical illustrations generated from stated assumptions; they are not the results of any real fund, security, strategy, or Equity Rank output, and they do not predict future results.