Machine learning models · Phase 1 · Lesson 5

Bias, variance and generalisation

Diagnose underfitting and overfitting using the bias-variance idea.

This is one focused step in the 60-lesson course. Use the retrieval check before moving on.

Lesson goal

Diagnose underfitting and overfitting using the bias-variance idea.

The core idea

Bias is a model that is too rigid. Variance is a model that changes too much when the training sample changes.

Mental model

Picture it this way. Bias is a model that is too rigid. Variance is a model that changes too much when the training sample changes. The important question is what assumption this picture makes, and whether that assumption fits the data.

Mathematical core

Expected prediction error can be decomposed conceptually into bias squared, variance and irreducible noise. The useful model balances the first two.

Worked example

A depth-one tree may miss a nonlinear cancellation pattern. A very deep tree may memorise individual customers. A regularised intermediate tree can generalise better.

When to use it

It earns a place when

  • Use the idea to choose complexity, regularisation, data volume and validation experiments.
  • You can evaluate it against a credible baseline.
  • Its output fits the decision and data constraints.

Do not make it the default when

  • Do not use bias and variance as labels for every error. Data leakage, shift and bad targets can produce similar symptoms.
  • A simpler model has not been tested.
  • The data or target definition is still unclear.

Failure modes

Watch for this. A validation curve can be noisy, and a higher-capacity model can still win when enough representative data is available.

When a result looks surprisingly good, inspect the split, target timing, error slices and data-generating process before celebrating.

Practice

Use this as a small experiment rather than a recipe to copy blindly. Change one thing, record the result and explain the change.

Do this. Train models of increasing depth on a small dataset. Record training and validation scores and describe the shape of the gap.

Retrieval check

Answer from memory first. The buttons reveal feedback, but the durable step is explaining why.

1. What is a high-bias model likely to do?

2. What is a high-variance model likely to do?

3. Which intervention often reduces variance?

Transfer prompt. Describe one real problem where this model or idea would be a sensible candidate. Name the target, the main risk and the metric you would inspect.

Primary source

Google ML Crash Course. Use the source for the deeper treatment after you can explain the lesson's core idea without looking.