Trusting the result / 6 of 7
Overfitting and regularization
What you’ll learn
- Explain the main idea of “Overfitting and regularization” in your own words.
- Trace a concrete example and identify the assumptions behind it.
- Apply the principle in a practice problem and recognize a common failure.
The idea, intuitively
Overfitting occurs when a model learns training-specific details that do not transfer. A widening gap between training and validation performance is a warning. Underfitting instead means the model cannot capture useful structure even in training.
Think of the dataset as a sample from a larger environment. A useful model must transfer beyond that sample. Keep training choices separate from final evaluation, and compare against a simple baseline. Before selecting an algorithm, inspect what the labels mean and which errors matter to the user.
Under the hood
Regularization changes the learning problem to discourage overly complex solutions. Weight decay penalizes weights; dropout randomly masks activations during training; early stopping selects a checkpoint using validation behavior.
Regularization strength should be chosen with validation, not with repeated test-set tuning.
A worked example
A degree-20 polynomial can perfectly fit a small noisy sample but oscillate between points. A simpler model may predict unseen examples better.
How to use this way of thinking
Define the target, split the data, fit preprocessing only on training examples, and evaluate a baseline. Inspect individual failures alongside aggregate metrics. Change one major choice at a time and use validation evidence to decide whether the additional complexity earns its place.
Try it yourself
Suggest two responses to a large train-validation gap.
Key takeaways
- Training improves while validation deteriorates
- Regularization strength should be chosen with validation, not with repeated test-set tuning.
- Check the assumptions with a small example before applying this idea to a larger system.
Check your understanding
Use feedback to learn. Quiz scores and lesson completion are tracked separately.
Go to lesson completionFurther reading
Original papers and reference material for this school. External resources may be in English and require internet access.
Google Machine Learning Crash Course (opens a new tab)scikit-learn user guide (opens a new tab)Finish this lesson
Mark this lesson complete when you’re ready to continue.