ML Fundamentals: lesson 7 of 7

ML Fundamentals

PATH 02MODULE 01LESSON 07 OF 07

Overfitting, Underfitting, and Bias-Variance Intuition

Recognize when a model is too simple or too adapted to training data, and connect both cases to generalization.

Beginner16 min readmachine-learningoverfittingunderfittingbias-variance

Concept

Generalization fails in two common ways. An underfit model is too limited to capture useful structure. An overfit model captures training-specific noise or quirks that do not repeat on unseen data.

Underfitting

Imagine house price changes in a clearly curved pattern, but the model can only draw one rigid straight line. It may perform poorly on both training and validation examples because its assumptions miss meaningful structure. This is often described as high-bias intuition: the model is systematically too restrictive.

Overfitting

An extremely flexible model can bend around every unusual training house, including noise or recording quirks. Training performance may become excellent while validation performance is much worse. This is high-variance intuition: the fitted model is overly sensitive to the particular sample it received. Complexity is not automatically bad; overfitting also depends on data amount, noise, feature choices, and training decisions.

Training performanceValidation performanceLikely interpretation
PoorPoorPossible underfitting
ExcellentMuch worsePossible overfitting
GoodSimilarly goodHealthier generalization

These are clues, not a complete diagnosis. Data shift, noisy labels, or an unrepresentative validation set can create similar patterns.

A Business Example: Product Demand

Suppose a retailer forecasts weekly demand. A very limited model may predict almost the same demand every week, missing promotions and seasonal changes. Poor training and validation performance suggests it may be underfitting. A highly flexible model might memorize one unusual holiday campaign in training, producing excellent training results but weak validation forecasts. That is a possible overfitting pattern.

The difference is not simply "simple equals underfit" and "complex equals overfit." Model flexibility interacts with dataset size, representativeness, noise, feature quality, and training choices. A flexible model can generalize well with enough representative data and careful validation. A simple model can still overfit a weak or leaky feature.

Bias-Variance Intuition

Bias is the intuition that a model's assumptions are too restrictive, producing systematic errors such as forcing a curved relationship into a straight line. Variance is the intuition that a model changes too much when it sees a different training sample. Underfitting is often associated with high bias; overfitting is often associated with high variance. These labels guide investigation, not a complete mathematical diagnosis of every model.

Regression will make these trade-offs practical: you will inspect errors, compare how flexible models fit data, and later learn how regularization can control unnecessary flexibility.

Ways to Respond

For underfitting, improve useful features, choose a more suitable model, or reduce excessive constraints. For overfitting, simplify or regularize a model, gather more representative data, reduce noisy features, and validate carefully. Detailed regularization and tuning come later.

Module 1 Synthesis

You now understand what ML is, its broad types, X/y samples, the first fit-predict loop, training versus inference, valid data splits, generalization, and fit quality. Module 2 examines a model family, regression, in greater depth.

Failure Signals

Common Mistakes

  1. Calling every complex model overfit.
  2. Calling a low training score good generalization.
  3. Diagnosing only from one split.
  4. Treating bias and variance as a complete formula for every model.

Interview Perspective

Question: How do you recognize overfitting? Answer: training performance is much stronger than performance on held-out data, suggesting the model learned sample-specific patterns. Follow-up: name two possible responses.

Practice Questions

  1. A model performs poorly on training and validation data. What is a likely issue?
  2. Why can more representative data reduce overfitting risk?
  3. Should a near-zero validation gap always prove a healthy model? Why not?

Quick Quiz

  1. Which pattern suggests overfitting? Answer: strong training and much weaker validation performance.
  2. High bias is commonly associated with what? Answer: underfitting.
  3. Does complexity alone determine overfitting? Answer: no.

Key Takeaway

Key Takeaways

Useful models balance fit with generalization. Underfitting misses structure; overfitting memorizes unreliable detail; validation evidence helps distinguish the risks.

Next Lesson

Next, begin Module 2 and study regression problems and models in depth.

Finish this lesson on your terms

Mark it complete when you have worked through the material and are ready to move on.