Training data, validation, and leakage
A data split keeps some examples separate so you can measure how well a model handles new data.
How it works
Think of the final split as questions the model has never studied. If you use their answers to choose settings or to compute preprocessing, the result no longer measures that unfamiliar behavior cleanly. Reserve the split before training or tuning.
Walk through an example
The training set fits the model. The validation set helps choose settings. The final test set estimates results after you finish making choices.
What to watch for
Calculate preprocessing statistics from the training set. Using the whole data set can leak information into training that would not be available for real predictions.
Check your understanding
Which split should determine the mean and standard deviation?
See the example and explanation
- Worked example
- Given
You standardize numeric columns before training. - Answer
The training split.
Fit the preprocessing only on training, then apply the same learned transformation to validation and test data.