Training vs Testing DataHonest Evaluation & Overfitting
Discover why we split datasets, explore the dangers of overfitting, and see how testing on unseen data proves real-world performance!
Training vs Testing Data
Don't cheat on the exam!
When building an AI model, we never test it on the exact same data we used to train it. That would be like memorizing practice exam questions beforehand โ it doesn't prove you actually learned the subject!
Dataset Splitting Pipeline
Model learns patterns from this
Unseen check of real ability
Beginner Explanation: Training Data is what the model learns from. Testing Data contains hidden, unseen examples used to check how well the model works in the real world!
Why Split Data?
Honest Evaluation & The Student Analogy
The Student Exam Analogy
If a student gets the exact exam questions 2 weeks before the test, they might score 100% simply by memorizing answers. But when given a brand-new test, they fail! Similarly, testing an AI model on its training data gives a false high score.
The test set acts as an honest final exam on unseen data. Standard practice is to split data into 80% training and 20% testing.
โ Quick Question: Should we test an AI model using the same examples it trained on?
Overfitting & Underfitting
Finding the Sweet Spot
๐จ Overfitting
The model memorizes training noise instead of learning general rules. It gets 99% in training, but fails on new test data!
๐ Underfitting
The model is too simple to learn basic patterns. It scores poorly on both training (55%) and testing (55%).
๐ Interactive Activity: Which Model Generalizes Better?
Compare the training vs testing accuracy of both models below:
Playground: Dataset Splitter
Visualizing Splits & Overfitting
Adjust the percentage slider to split a fixed 20-item dataset into Training vs Testing data:
๐ Training Data (16 items)80%
๐งช Testing Data (4 items)20%
Model Evaluation Simulation
Interactive Exercises
Exercise 1: Spot the Overfitting
+15 XP ยท BeginnerExercise 2: Ideal Split
+20 XP ยท BeginnerExercise 3: Underfitting Signs
+25 XP ยท IntermediateExercise 4: The Validation Set
+30 XP ยท IntermediateKnowledge Check
Ready to test your knowledge?
Answer 10 multiple-choice questions to test your understanding of training, testing, and overfitting!
Build Real Machine Learning Models with Tutors
Take the next step! Join our live Intro to Machine Learning Course and write real Python ML code with expert 1-on-1 guidance.