ml4t-purging-embargo

Installation
SKILL.md

Purging and Embargo

Standard train/test splits on time series leak information when labels span multiple periods. Purging removes contaminated training samples; embargo adds an extra buffer for feature autocorrelation.

The Problem

A 5-day forward return label at day 98 uses prices from days 98-103. If the test set starts at day 100, training sample 98 contains information about test-period prices. Without purging, the model sees future test data through overlapping labels. Without embargo, autocorrelated features near the boundary still carry test-period signal. Both inflate CV scores and produce unreliable strategy evaluation.

The Pattern

WRONG

from sklearn.model_selection import TimeSeriesSplit
Installs
21
Repository
ml4t/skills
GitHub Stars
39
First Seen
Sep 13, 2026