Why the split is the whole game
A model is judged on data it has not seen. In finance there are three sets: training data to fit, validation data to choose settings and test data, used once, to report the result. They must follow time: train on the past, validate on the next stretch, test on the last one. A random split puts days from the same storm in both sets, so the model recognises neighbours instead of learning a rule. Leakage means that information from the validation or test period reaches the training step. It comes in four common forms: a scaler fitted on all days, a feature that uses a future price, a target-like column that is known only afterwards, and labels that overlap in time.
Overlapping labels deserve special care. If the label is the return over the next months, the label of a training row and of a test row share months whenever . The last training rows before the test period therefore know part of the test outcome. The cure is purging, which drops those rows, and an embargo, which keeps a safety gap, as the next topics show. A small number shows the size of the problem: with monthly rows, a split puts the test period at row , and for two training rows near each boundary overlap.
- Split by time: train on the past, validate on the next stretch, test on the last, and look at the test once.
- Four leaks: fitted preprocessing, future features, target-like columns and overlapping labels.
- A shuffled score is a warning sign: if shuffling the days raises the score a lot, the model is recognising neighbours.
Lab · what's graded
- Where the test period starts10 pts
- The training size10 pts
- What the scaler learns from the future10 pts
- Overlapping labels15 pts
- How much a shuffle flatters10 pts
- The right split for a time series10 pts
- A leak-free workflow10 pts
- Kinds of leakage10 pts
- Why shuffling inflates the score15 pts