Course contentsShow
← Machine Learning and Deep Learning
Lesson 140 of 3,5382. Machine Learning Mindset and Core ConceptsFree lesson

Train-Validation-Test Split Philosophy

Why we split data into three sets and the principles behind preventing data leakage.

Train-Validation-Test Split Philosophy

What you'll learn: Why machine learning requires splitting your data into three distinct sets and how this protects your model from "cheating."

The Core Problem: Honest Performance Evaluation

Imagine studying for an exam using practice problems, then taking the exact same problems as your final test. Your score would look fantastic, but would you truly understand the material? Of course not.

Machine learning faces the same challenge. Models are excellent at memorizing patterns in data they've seen. To know if your model can handle new, unseen situations—the entire point of ML—you must evaluate it on data it has never encountered during training.

The Three-Set Split

Training Set (typically 60-80% of data): Your model learns patterns here. It sees these examples repeatedly and adjusts its parameters to fit them.

Validation Set (typically 10-20%): You use this to tune your model's hyperparameters and make architectural decisions. The model doesn't train on this data, but you do use its performance here to guide your choices.

Test Set (typically 10-20%): The final, untouched dataset. You evaluate on this only once, after all decisions are made. This gives you an honest estimate of real-world performance.

Preventing Data Leakage

The golden rule: information from validation or test sets must never influence your model during training. Even indirect leakage—like choosing features based on test set performance—creates falsely optimistic results.

Think of the test set as a sealed envelope you open only at the very end. The validation set is like a practice exam—you can use it to improve, but it's still "cleaner" than your study materials.

Key Takeaway: Splitting data into train/validation/test sets is how we ensure honest evaluation and prevent models from simply memorizing rather than learning generalizable patterns.