ml4t-cpcv
Installation
SKILL.md
Combinatorial Purged Cross-Validation
Standard k-fold CV on time series produces one biased performance estimate. CPCV generates C(N,k) train/test combinations with purging and embargo, yielding a distribution of results that reveals overfitting.
The Problem
A single train/test split gives one Sharpe ratio - you cannot tell if it is skill or luck. Standard k-fold shuffles temporal order, leaking future information. Even TimeSeriesSplit produces only a handful of sequential folds, each with different train sizes, making comparison unreliable. You need many unbiased performance samples to build a distribution.
The Pattern
Partition data into N groups, select k as test sets, train on the rest. Purge samples whose labels overlap the test boundary, add an embargo buffer. Repeat for all C(N,k) combinations.
WRONG
from sklearn.model_selection import KFold