AI/ML Foundations

Training, Validation & Test Sets

A model learns from the training split, is tuned against the validation split, and is judged on a final held-out test split. The point is not to reward memorization, but to estimate future performance.
  • Training data fits model parameters
  • Validation data guides choices
  • Test data is the final audit
  • Splits must match production reality
  • Cross-validation helps when data is limited
Split discipline
The test set validates the chosen process; it should not help choose it.
Common splitting strategies
StrategyUse whenAvoids
Random row splitIID examples with no grouping/time issuesBasic train/test contamination
Time-based splitForecasting, event streams, historical predictionTraining on the future
Group/user splitMultiple rows per user/account/documentSame entity in train and test
Stratified splitClassification with class imbalanceMissing rare classes in a split
Sources
  • Machine Learning Crash CourseDatasets, Generalization, and Overfitting
  • scikit-learn User GuideModel selection and evaluation
  • An Introduction to Statistical Learning with PythonResampling Methods