Three Sets, Three Jobs
Do not grade with study material
The training set is the portion used to fit model parameters. The validation set is separate evidence used to compare algorithms, choose settings, and decide thresholds. The test set is a final sealed holdout used once after those decisions, giving the least-biased estimate of how the chosen system handles unseen cases.
training 70% -> learn parameters
validation 15% -> choose model and settings
test 15% -> final report after choices are frozen
Why not just train and test? Repeatedly viewing a test score while making changes gradually tunes decisions to that test set, even if its rows never enter fit(). The test set has become a hidden validation set. For small datasets, cross-validation can reuse training data more efficiently for selection, while an untouched final holdout remains valuable.
Analogy: Training contains practice problems with feedback. Validation is the mock exam used to decide what to revise. Test is the sealed final exam. Opening the final exam after every study session destroys its role.
Warning: Split before fitting imputers, scalers, encoders, feature selectors, or dimensionality reduction. Anything that learns from values must learn from training rows only.