Skip to content
Statistical Arbitrage / Backtesting and Validation

Purged K-Fold Cross-Validation: Eliminating Look-Ahead Leakage

Standard kk-fold cross-validation partitions the dataset into kk folds, trains on k−1k-1, and tests on 1, cycling through all folds. In finance this fails: financial returns are serially correlated and overlapping labels (returns spanning multi-day windows) create information leakage from the testing set into the training set. A classifier trained on observations that inadvertently share information with the test set will overestimate its out-of-sample performance — even if the test fold was never explicitly seen during training.
Purged kk-fold CV fixes this with two operations: purging (removing training observations whose labels overlap with any testing label) and embargoing (removing training observations that immediately follow the test set, where serial correlation may carry test information backward). Together, these ensure the training set contains no information that could not have been known at the start of the testing period.
Learning objectives. By the end of this note you should be able to:
  • identify the two sources of leakage in standard k-fold CV (label overlap, serial correlation);
  • define purging and state which training observations are removed;
  • define embargoing and select an appropriate embargo length hh;
  • implement the Purged K-Fold CV procedure algorithmically;
  • explain why increasing kk in a purged CV (unlike standard CV) does not always improve performance monotonically.

In this lesson

    1. Why standard k-fold CV fails in finance
    1. Purging
    1. Embargoing
    1. Effect on k-fold performance estimation

Before you start

The full lesson, with worked examples and exercise solutions, is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or browse the Statistical Arbitrage syllabus.