2.6.10 · D3Model Evaluation & Selection

Worked examples — Regression metrics (MAE, MSE, RMSE, MAPE)

2,710 words12 min readBack to topic

This page is a drill. We take the four metrics from Regression metrics (MAE, MSE, RMSE, MAPE) — MAE, MSE, RMSE, MAPE — and throw every kind of input at them: negative errors, an outlier that dominates, a perfect prediction, a zero-valued target that breaks MAPE, and a couple of word/exam twists. If the parent taught you the recipe, this page makes you cook every dish.

Before we begin, one shared reminder so no symbol is unearned:


The scenario matrix

Every regression-metric problem lands in one of these cells. Each worked example below is tagged with the cell(s) it covers, and together they cover the whole table.

Cell Scenario class What makes it tricky Example
A Mixed-sign residuals (over- and under-prediction) Signs must not cancel Ex 1
B One large outlier vs many small errors MSE/RMSE explode, MAE stays calm Ex 2
C Degenerate: all errors equal RMSE = MAE exactly (the equality edge) Ex 3
D Perfect prediction (all ) Every metric must return Ex 4
E MAPE with a zero target () Division by zero — undefined Ex 5
F MAPE asymmetry (same abs error, different %) Over- vs under-estimate penalised differently Ex 6
G Real-world word problem (choose the metric) Reasoning, not just plugging in Ex 7
H Exam twist: two models, same MAE, different MSE Metric choice changes the winner Ex 8
I Limiting behaviour: scale the errors, watch RMSE/MAE ratio RMSE ≥ MAE always; when equal? Ex 9

Example 1 — Mixed-sign residuals (Cell A)

Step 1 — residuals with sign. .

Why this step? We keep signs first so we can see that a naive sum would let the cancel the . Cancellation is exactly the disease MAE and MSE cure.

Step 2 — kill the signs, MAE way (absolute value). , so

Why this step? Absolute value answers "how far, ignore direction?" — a and a are equally wrong, so both become .

Step 3 — kill the signs, MSE way (squaring). , so

Why this step? Squaring also removes signs, but it inflates the into — five times the error becomes twenty-five times the contribution. That's the whole personality difference between the two metrics.

Recall Verify

Signs did not cancel: MAE even though . Units: MAE is in °C (same as target), MSE is in °C² (squared). The residual supplies of MSE but only of MAE — the outlier already leans on MSE harder.


Example 2 — One big outlier (Cell B)

Step 1 — MAE.

Why this step? MAE treats the $200k miss as "just 200 units" — no extra punishment. It is the robust metric: one monster barely bends the average beyond its own weight.

Step 2 — MSE. , so

Why this step? Squaring turns into . Now the single outlier owns of the total. MSE is a megaphone for big mistakes.

Step 3 — RMSE (restore units).

Why this step? MSE's units are $1000-squared — meaningless to a client. The square root brings us back to $1000s while keeping the outlier's amplified influence baked in.

Recall Verify

. The parent's rule "if RMSE ≫ MAE you have outliers" fires loudly here (ratio ). Sanity: RMSE ($100k) sits between the small errors ($5k) and the giant ($200k), pulled hard toward the giant — exactly what an outlier-sensitive metric should do.


Example 3 — All errors equal (Cell C, the equality edge)

Step 1 — MAE.

Step 2 — RMSE. , , so .

Why this step? When every error is identical, squaring then averaging then rooting just returns that same value: . There is no spread for RMSE to punish, so the two metrics tie.

Why this figure? The blue bars (equal errors) give RMSE = MAE — the pillars are flat. The orange bars (one spike) pull RMSE above MAE. The gap between the two horizontal lines is the outlier penalty, made visible.

Recall Verify

RMSE MAE exactly. This is the only situation where equality holds: uniform errors. Any variation in error magnitude forces RMSE strictly above MAE.


Example 4 — Perfect prediction (Cell D, degenerate zero)

Step 1 — residuals. .

Step 2 — plug into all four.

Why this step? A metric that didn't return for a perfect model would be broken. Notice MAPE is safe here even though it divides by — because are all non-zero. The numerator being makes each fraction .

Recall Verify

All four metrics . This is the universal "floor": every regression metric is and hits only for a flawless fit. Good models push toward this floor.


Example 5 — MAPE with a zero target (Cell E, undefined)

Step 1 — set up MAPE term by term.

Why this step? MAPE's formula demands . Sample 2 has , so we divide by — no finite answer. MAPE cannot be computed on this dataset. This is not a rounding issue; the metric is genuinely inapplicable.

Step 2 — fall back to MAE (always defined). , so

Why this step? MAE never divides by the target, so zeros are harmless. Whenever your target can be (counts, demand, defect rates), reach for MAE/RMSE and drop MAPE.

Recall Verify

MAPE = undefined (division by zero at ); MAE is well-defined. Rule confirmed from the parent's MAPE warning: "undefined when ." If you ever see a library return a huge or inf MAPE, hunt for a zero actual.


Example 6 — MAPE asymmetry (Cell F)

Step 1 — MAPE for each (single sample, so no averaging).

Why this step? When we always divide by the true , both give . So on this definition MAPE is symmetric. The asymmetry the parent warns about appears when people (or libraries) divide by the prediction or measure error relative to different denominators.

Step 2 — see the real asymmetry: divide by prediction (a common wrong variant). If someone uses instead:

Why this step? Now the same $10 miss reads as for underprediction but for overprediction. That gap is the notorious asymmetry: percentage-of errors depend on which number sits in the denominator.

Why this figure? Two number lines centred on the truth . The green (under, 90) and red (over, 110) arrows are the same length in absolute terms, but the percentage they represent shifts depending on the denominator — the figure shows the equal arrows and the unequal percentages beside them.

Recall Verify

Divide-by-truth: both (symmetric). Divide-by-prediction: vs (asymmetric). Takeaway: always state which denominator your MAPE uses, and prefer sMAPE (from the parent) when direction of error matters.


Example 7 — Word problem, pick the metric (Cell G)

Step 1 — translate the business goal into error tolerance. A blackout is catastrophically worse than routine 2 MW slop. So one 50 MW error must dominate the score, not blend in.

Why this step? Metric choice is a values choice. "Big errors hurt disproportionately" is precisely the property that separates squared-error metrics from MAE.

Step 2 — pick RMSE (or MSE for training). Squaring turns the 50 MW miss into versus a routine — a amplification — so RMSE forces the model to prioritise never having a huge miss. Report in RMSE (MW, interpretable); optimise in MSE (smooth for Gradient descent and Loss functions in neural networks).

Step 3 — check the alternative. If instead a "MW late is a MW late" attitude were true (no catastrophe threshold), MAE would be the honest choice, and you'd worry that RMSE over-reacts to one outlier via Outlier detection.

Recall Verify

Correct pick: RMSE/MSE, because the loss function's shape (quadratic) matches the real-world cost (blackout risk grows fast with error). Units of RMSE = MW, so the utility can report "typical miss ≈ X MW" to non-technical stakeholders. This ties into Model comparison where benchmarks standardise on RMSE.


Example 8 — Exam twist: same MAE, different winner (Cell H)

Step 1 — MAE for both.

Why this step? MAE only sees the total magnitude ( in both cases). It declares a tie — a trap if you stop here.

Step 2 — RMSE for both. : , MSE , RMSE . : , MSE , RMSE .

Why this step? Squaring exposes the distribution, not just the total. Model B concentrates all its error into one huge , which squares to and dominates. RMSE ranks A strictly better.

Step 3 — decide by context. If large single errors are dangerous, choose A (RMSE says so). If total error is all that matters, they're genuinely tied (MAE says so). The metric encodes the decision.

Recall Verify

(tie). , (A wins by RMSE). This is exactly the parent's "MAE and MSE don't always rank models the same" pitfall — the exam's favourite gotcha. Relates to Bias-variance tradeoff: B's concentrated error may signal a systematic failure on one regime.


Example 9 — Limiting behaviour: scale the errors (Cell I)

Step 1 — scale MAE. Errors become , so MAE scales linearly with (it's an average of first powers).

Step 2 — scale RMSE. , MSE , so RMSE also scales linearly with (the inside the root becomes outside).

Step 3 — the ratio is invariant.

Why this step? Both metrics are homogeneous of degree 1 — scale all errors, both scale the same way, so the ratio (which measures error spread/shape, not size) stays fixed at . The ratio is a fingerprint of the error distribution, immune to how you scale the target (this is why Feature scaling changes raw metric values but not this shape ratio). At the equal-error limit (Ex 3) the ratio is ; the more concentrated the errors, the larger it grows.

Recall Verify

MAE , RMSE , ratio for any . Limiting facts confirmed: RMSE/MAE always, only for uniform errors, and under concentration — independent of scale. Cross-check with real data via Cross-validation to ensure the ratio is stable across folds, not a one-fold fluke.


Recall Self-test

RMSE and MAE are equal only when… ::: all individual errors have the same magnitude (Ex 3). Two models with identical MAE can still differ in… ::: RMSE/MSE, because those punish error concentration (Ex 8). MAPE becomes undefined when… ::: any true value (Ex 5). Multiplying every error by changes MAE and RMSE but leaves ::: their ratio unchanged (both scale linearly, Ex 9).