Phase 1: Prepare
Step 1 Warm-up recall
From M2.L1: why do signed errors cancel?
Private: nothing you type here is sent or stored.
Step 2 Learning goal
By the end of this lesson you can:
- compute mean absolute error by hand (Foundation);
- compute root mean squared error by hand (Core);
- say when RMSE and MAE differ and why (Core).
Phase 2: Teach
Step 3 A familiar example
A teacher marks five scripts and wants one number for how far her predicted grades were from the real ones. She averages the gaps. That average is the mean absolute error.
Step 4 Clear explanation
The mean absolute error (MAE) is the average of the absolute errors. In the invented table below the model's absolute errors are 10, 5, 10, 5 and 10, which total 40, so MAE = 40 ÷ 5 = 8 (thousand pounds). The baseline, which always predicts the mean of 240, has errors 40, 20, 0, 20 and 40, total 120, so its MAE is 24.
| Home | Actual | Model | Model abs. error | Baseline (mean 240) | Baseline abs. error |
|---|---|---|---|---|---|
| A | 200 | 210 | 10 | 240 | 40 |
| B | 220 | 215 | 5 | 240 | 20 |
| C | 240 | 250 | 10 | 240 | 0 |
| D | 260 | 255 | 5 | 240 | 20 |
| E | 280 | 290 | 10 | 240 | 40 |
The root mean squared error (RMSE) squares each error, averages the squares and takes the square root. For the model: 100, 25, 100, 25 and 100 total 350; ÷ 5 = 70; the square root is about 8.4. Squaring means big errors count much more, as the next table shows.
| Errors (five cases) | Mean absolute error | Root mean squared error | What it shows |
|---|---|---|---|
| 2, 2, 2, 2, 2 | 2 | 2 | every error the same size, so the two agree |
| 2, 2, 2, 2, 12 | 4 | about 5.7 | one big miss lifts RMSE much more than MAE |
Use MAE when every unit of error costs about the same. Use RMSE when large misses are especially harmful, as with a flood level or a drug dose. Whatever you pick, say which it is, because the two give different numbers for the same model. Both are in the units of the label, so 8 means eight thousand pounds, not 8 percent.
Step 5 Worked example (4 marks)
A model's errors on four cases are +2, −3, +1 and −4. Find MAE and RMSE.
- Absolute errors: 2, 3, 1, 4; total 10; MAE = 10 ÷ 4 = 2.5. (1 mark)
- Squares: 4, 9, 1, 16; total 30. (1 mark)
- Mean of squares = 30 ÷ 4 = 7.5; RMSE = √7.5 ≈ 2.74. (1 mark)
- Answer: MAE 2.5 and RMSE about 2.7; RMSE is larger because of the 4. (1 mark)
Go deeper: the professor's notes
Average size.
Big misses count.
Of the label.
Choice
| Cost of a miss | Measure |
|---|---|
| proportional | MAE |
| rises sharply with size | RMSE |
At work: A forecast
A late delivery costs more than an early one.
- Decide which misses are worst.
- Choose RMSE or a weighted loss.
What a careful practitioner decides. The measure should reflect what a mistake really costs.
Phase 3: Practise
Step 6 Learner practice (instant-marked)
1. MAE is the:
Average of sizes.
2. Errors 1, 3, 5 give a mean absolute error of:
(1 + 3 + 5) ÷ 3.
3. RMSE is more affected than MAE by:
Squaring magnifies big errors.
4. If MAE for house prices is 8 (in £ thousands), the typical miss is about:
Same units as the label.
Phase 4: Close
Step 7 Recap
- MAE averages the absolute errors.
- RMSE squares, averages and takes the root, so big errors count more.
- Both are in the units of the label; say which you used.
Step 8 Exit ticket (ungraded)
Errors are 1, −1, 2 and −2. Find the MAE.
Private: nothing you type here is sent or stored.
Step 9 Go further (Extension)
Find a case where the choice of MAE or RMSE would change which of two models looks better.
In industry: Netflix Prize: the last gap
The winning team in September 2009 reached 0.8567 on the test set, an improvement of 10.06 percent on the company's system, which was just enough to meet the target.
Link to this lesson. A small number of decimal places can decide a contest, so the measure and the data it is computed on must be fixed beforehand.
Source: Feuerverger, He and Khatri (2012), Statistical Significance of the Netflix Challenge
Common mistakes
| Mistake | Why it fails |
|---|---|
| Forgetting to divide by the number of cases | It is a mean. |
| Forgetting the square root in RMSE | Root of the mean of squares. |
| Quoting a bare number without units | Say pounds, minutes or percentage points. |
Limits. Other loss measures exist, for example for percentages; this lesson uses the two most common.