Overfitting, underfitting, and regularization
Every model walks a tightrope between memorizing the training data and failing to learn enough. Here we learn to spot the fall and catch it with regularization.
Before We Begin
Bias and variance are two sides of the same coin. A high-bias model is too simple—it underfits, missing the real pattern like a student who skims the textbook. A high-variance model is too complex—it overfits, memorizing every quirk of the training data like a student who crams specific answers instead of understanding concepts. Regularization techniques like L1, L2, dropout, and early stopping add a gentle penalty that keeps the model honest.
How this lesson fits
Building a model is one thing; training it well and knowing whether it actually works is another. This module covers the engine room of ML: how optimization drives learning, how bias and variance shape model behavior, how to pick the right scoreboard, and how to run experiments you can trust.
The big question
How do we train a model effectively, measure its true performance, and make sure our results are not just a fluke?
Why You Should Care
The bias-variance trade-off is the single most important diagnostic framework in ML. Students who understand it can look at a training curve and immediately prescribe a fix: more data, simpler model, or regularization. It prevents the most common beginner mistake—chasing higher training accuracy while real-world performance crumbles.
Where this is used today
Think of it like this
Think of studying for an exam. If you barely read the material, you will fail because you did not learn enough (underfitting). If you memorize every example word-for-word but never understand the principles, you will freeze on any new question (overfitting). The sweet spot is deep understanding without rote memorization—and regularization is the study strategy that keeps you there.
Easy mistake to make
Overfitting is not "the model is too good." It means the model learned patterns that exist only in the training data and do not generalize. A truly good model scores well on data it has never seen.
Think about this first
A model scores 99% on the training set but only 60% on new data. What is going on, and what would you try first?
Words we will keep using
Every model walks a tightrope between underfitting (too simple, misses the pattern) and overfitting (too complex, memorizes noise). The bias-variance tradeoff is the diagnostic framework that tells you which side you're falling toward.
The true relationship is quadratic. Orange dots are training data, green dots are test data. Increase the polynomial degree and watch the model wiggle to fit training noise while test error explodes.
Low degree \u2014 the model is too simple (high bias / underfitting).
As complexity increases, training error always goes down. But test error follows a U-shape: it decreases, hits a sweet spot, then climbs back up as the model starts memorizing noise.
Regularization adds a penalty for complexity, forcing the model to stay simpler even when it has the capacity to overfit. It's the study strategy that prevents rote memorization.
Drives some weights to exactly zero \u2014 automatic feature selection.
Shrinks all weights toward zero \u2014 no feature is completely dropped.
Randomly disables neurons during training. Forces the network to not rely on any single pathway.
Monitor validation loss. Stop training the moment it starts rising \u2014 before overfitting sets in.