ml4t-data-leakage

Installation
SKILL.md

Data Leakage

Leakage lets test-set information influence training, producing models that look good in development but fail in production.

The Problem

Three distinct failure modes inflate backtest performance:

  1. Target leakage - features computed from the target variable (e.g., future returns embedded in a "sentiment score" that was derived from price changes).
  2. Train-test contamination - fitting a scaler, encoder, or selector on the full dataset before splitting, so test statistics leak into training transforms.
  3. Temporal leakage - using future data in features (overlaps with lookahead bias, but here the mechanism is the train/test split itself, not the feature formula).

A pipeline that fits a StandardScaler on the full matrix before splitting commonly inflates Sharpe by 0.2-0.5 on daily data. The model learns the test set's distribution.

The Pattern

WRONG

Installs
23
Repository
ml4t/skills
GitHub Stars
39
First Seen
Sep 13, 2026