Three Datasets, Three Roles
- Training set — the model sees this. Updates its weights.
- Validation set — the model never trains on this. You use it to tune hyperparameters (model size, learning rate, regularization strength).
- Test set — the model never trains on AND you never tune on. Used once, at the end, to estimate real-world performance.
Why All Three
If you only have train + test, you'll be tempted to tune hyperparameters by checking test performance — and the test set becomes secretly training data. Your final reported number will be optimistic. The validation set absorbs the tuning, leaving the test set genuinely held out.
Common Disasters
- Data leakage — test data sneaking into training (often via preprocessing). Standardize using only training statistics, not the whole dataset.
- Test set peeking — running the test set repeatedly during development. After enough peeks, your test set is contaminated.
- Time-series leakage — for time data, the future leaking into the past. Always split chronologically for time series.
The Kaggle leaderboard effect. Top teams sometimes overfit the public leaderboard (essentially a validation set), then drop dramatically on the private (test) leaderboard. The math punishes peeking, even when peeks are aggregated.
The test set is sacred. Look at it once. Twice means you've corrupted your evaluation.