Model Evaluation
Why you can't trust the training set — the logic of train/val/test splits.
A model that just memorises the answers will score 100% on the data it has seen. To measure actual learning, we need a sealed envelope of data it has never seen.
The Three Partitions
The dataset is divided into three parts. Train teaches the model. Validation tunes the hyperparameters. Test provides an honest, final evaluation.
The Evaluation Loop
The engineer cycles between training and validation, adjusting the model until it performs well. The test set is opened exactly once, at the very end.
Data Leakage
Leakage happens when information from the validation or test set accidentally seeps into the training process, leading to artificially high scores.
Where It Breaks
A perfect test score is useless if the test set doesn't reflect the distribution of data the model will encounter in production.
The Quick Version
- Training accuracy: Lies because models can memorise.
- Validation set: Used to tune hyperparameters.
- Test set: Used exactly once for honest evaluation.
- Leakage: When test info corrupts training.
- Failure: Test distribution mismatching production.