Lesson 2.2 · 6 min read · about 50 min to master at a very slow pace
Empirical Risk Minimisation (ERM)
ERM chooses the model in a family with the lowest training loss. OLS and logistic regression are both ERM. Why minimising training loss is necessary but not sufficient.
The recipe
We can't minimise population risk because we can't compute it. So we do the next best thing: pick a family of candidate functions (for example "all straight lines") and choose the member with the smallest average training loss.
Empirical risk minimisation
"" means "the that achieves the minimum", not the minimum value itself.
Familiar methods are all ERM
| Method | Family | Loss |
|---|---|---|
| Ordinary least squares | Linear functions | Squared loss |
| Logistic regression | Sigmoid of a linear score | Cross-entropy |
| Linear SVM | Linear scores | Hinge loss (+ penalty) |
| Ridge / LASSO | Linear functions | Squared loss + penalty on |
The last two rows add a penalty for complexity: that is regularised ERM, the subject of Section 5.
Two choices control what ERM finds
- The family : too narrow, and even the best member is poor (underfitting). Too rich, and some member can fit the training noise exactly (overfitting).
- The loss : determines what "best" means.
Minimising training loss ≠ minimising true loss
minimises , not . A very flexible family can drive training loss to zero while population risk stays large. That's why ERM is always paired with an honest estimate of performance on data not used for fitting.
How it's asked
"OLS is empirical risk minimisation with squared loss. Explain in plain words." Among all straight lines (or planes), OLS picks the one whose average squared vertical distance to the training points is smallest.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passIs minimising the objective the same thing as ERM?
Without a penalty, yes: the objective is the empirical risk, and ERM is the principle of choosing the model that minimises it. With a penalty it is regularised ERM: minimise . Ridge, LASSO and the soft-margin SVM are all regularised ERM.
First passWhat is the difference between ordinary ERM and regularised ERM?
Ordinary ERM trusts the training data completely: it picks whatever fits it best. With a flexible model, that includes fitting the noise. Regularised ERM adds a penalty on complexity, , and gives up a little training error for a simpler model that generalises better. sets the trade-off and is chosen by cross-validation (Section 5).
Going deeperHow do loss, empirical risk, ERM and optimisation fit together?
- Choose a loss: how one wrong prediction is scored.
- Average it over the training set: the empirical risk.
- ERM says: pick the model in your family with the lowest empirical risk (plus a penalty, if regularised).
- Optimisation is how you actually find it. OLS has a formula, the normal equations. Logistic regression has none, so it is solved step by step with gradient descent or Newton's method.
- Then check the result on held-out data, because a low empirical risk doesn't guarantee a low population risk.
Cheatsheet
ERM
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.