Lesson 1.5 · 8 min read · about 50 min to master at a very slow pace

Empirical Risk and Population Risk

Population risk is the error we truly care about; empirical risk is the error we can compute. The gap between them is the central problem of machine learning.

Not startedJump to quiz

The setting

Assume each observation is an independent draw from some unknown data-generating distribution . We never see itself, only a finite sample of draws from it. We want a function whose predictions are close to for new draws from the same .

Loss: scoring a single prediction

A loss function measures how bad one prediction is. For regression the usual choice is squared loss . Choosing the loss is a real modelling decision (lesson 2.1).

Two risks

Population risk: what we care about

The average loss over the whole, unknown population.

Empirical risk: what we can compute

The average loss over the observations in our sample.

Because is unknown, can't be computed. is our estimate of it. On the training data it is the training error.

Worked example: computing empirical risk

A model predicts for true values .

Residuals .

Squared-loss empirical risk: .

Absolute-loss empirical risk: .

Same predictions, two different risks, because the two losses punish errors differently.

Why the gap matters

Fitting a model means making small. But a flexible enough model can make training error tiny by memorising the sample, noise and all, while its population risk stays large. The difference

is the heart of Section 2. We can't compute it exactly, so we estimate using data the model was not trained on.

How it's asked

"Explain the difference between population risk and empirical risk. Which one can be computed?" Say: population risk is expected loss over the unknown distribution and cannot be computed; empirical risk is average loss on the sample and can. Minimising training loss does not guarantee minimising population risk.

Cheatsheet

Population risk

: expected loss over the unknown population. Cannot be computed.

Empirical risk

: average loss on the sample.

Generalisation gap

. Estimated with held-out data.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1calculatePredictions ; true values . What is the empirical risk under squared loss?
Q2calculateSame data: , . What is the empirical risk under absolute loss?
Q3conceptWhy can't population risk be computed directly?
Q4interpretA model has MSE 0.5 on its training data and MSE 4.0 on fresh data from the same source. What does this indicate?
Q5conceptA model reaches zero training loss. What can you conclude about its population risk?