Overfitting Lab
Watch a model go from underfitting to just right to badly overfitting โ and discover why a model that's too clever on training data fails completely on new data!
The Bias-Variance Trade-off
Underfitting
Model is too simple โ misses the real pattern. High training error AND high test error. "The model didn't learn."
Just Right
Model captures the true pattern without memorising noise. Low training error AND low test error. The goal!
Overfitting
Model memorises training data โ even the noise. Very low training error but HIGH test error. "It cheated."
Regularisation
Penalise model complexity. Forces simpler solutions. L1, L2, dropout โ all ways to prevent overfitting.
Step 1 โ Create Your Dataset
0 points๐๏ธ Controls
Error Scores
Step 2 โ Explore Model Complexity
Error Scores
Step 3 โ Learning Curves
Step 4 โ Regularisation: The Fix
โ Overfit (Degree 12, no reg.)
โ Regularised (Degree 12 + ฮป)
Model Quality Badge!
You mastered overfitting, learning curves, and regularisation!
Optional. Stays on this device only โ not sent to WhizzStep.
Key Concepts Mastered
๐ Memorising Noise
When a model learns the training data too well โ including its noise โ it fails to generalise to new data.
๐ Too Simple
A model that hasn't learned the pattern at all. High bias. A straight line through clearly curved data.
โ๏ธ Held-Out Data
Keep some data hidden from training. Test error on this holdout reveals overfitting before deployment.
๐ก๏ธ Complexity Penalty
Add a penalty term to the loss function that grows with coefficient size. Forces simpler, smoother models.
โ๏ธ The Trade-off
High bias = underfit. High variance = overfit. The sweet spot balances both to minimise total error.
๐ K-Fold
Split data into K folds. Train on K-1, test on 1. Repeat K times. More reliable than a single train/test split.
About this lab
Learning objective: Fit a model to noisy data and see how it can memorise training examples instead of learning a generalisable pattern.
What this simplifies: A single small synthetic dataset is used; overfitting looks different across real-world datasets and model types.
Privacy: No learner input leaves the device.
Teacher prompt: Ask the class why this simulation might mislead someone who takes it too literally.
Reflect: What is one thing this activity showed you that you did not expect?
โ Back to all Labs