2.6.10 · D1Model Evaluation & Selection

Foundations — Regression metrics (MAE, MSE, RMSE, MAPE)

2,567 words12 min readBack to topic

This page assumes you have seen nothing. We build every letter, every bar, every symbol the parent note Regression metrics (MAE, MSE, RMSE, MAPE) throws at you — one at a time, each with a picture, in an order where nothing appears before it is earned.


1. What is a "prediction" and a "true value"?

Look at figure 1. The true rent sits at a solid dot on a number line; the model's guess sits at a hollow dot nearby. They almost never land on the same spot — that little space between them is the entire subject of this chapter.

Figure — Regression metrics (MAE, MSE, RMSE, MAPE)
Figure 1 — True value vs the model's guess. A number line for rent in $1000s: a solid coral dot marks the true value , a hollow lavender dot marks the guess , and a double-headed arrow between them labels "the gap = residual."


2. The index and the count — talking about many samples at once

You never have one rent to predict; you have a whole table of apartments. We need a way to say "the 3rd apartment" without inventing a new name every time.


3. The residual — the gap itself

Figure 2 shows the same four apartments as arrows: an arrow pointing right is a positive residual (undershoot), pointing left is negative (overshoot). The whole rest of the topic is: what do we do with these four arrows?

Figure — Regression metrics (MAE, MSE, RMSE, MAPE)
Figure 2 — Residuals keep a sign (direction of the miss). Four horizontal arrows, one per sample, spring from a central zero line: mint arrows point right for positive residuals (undershoot), coral arrows point left for negative residuals (overshoot), each labelled with its value , , and so on.


4. Absolute value — throwing away the sign

Two guesses can be equally bad while having opposite signs: and are both "off by 0.3." To score "how far, ignoring direction," we need a tool that removes the minus sign.

Look at figure 3: the residual arrows from figure 2 all get flipped to point the same way (rightward, all positive lengths) once we wrap them in . Their lengths are what we sum.

Figure — Regression metrics (MAE, MSE, RMSE, MAPE)
Figure 3 — Absolute value flips every miss positive. The same four arrows as figure 2, but now all lavender and all pointing right, each labelled with its magnitude — the sign has been erased, only the length remains.


5. Squaring — a different way to kill the sign (and punish big misses)

Absolute value is not the only sign-remover. Multiplying a number by itself also always gives a non-negative result, because a negative times a negative is positive.

Figure 4 draws both curves on the same axes: the V of against the bowl of . Notice how the parabola sits below the V for small errors but rockets above it for large ones — that crossover is the whole personality difference between MAE and MSE.

Figure — Regression metrics (MAE, MSE, RMSE, MAPE)
Figure 4 — vs : corner versus bowl. Two curves on the same error axis: the coral V-shape of the absolute value with a sharp corner at zero, and the lavender parabola which is smooth at zero but shoots far higher for large errors — a picture of why MSE punishes big misses more than MAE.


6. The summation sign — "add up everything"

We have four residuals (or squares, or percentages). We need to pile them into one number. That pile-up has a single symbol.


7. Averaging — a total is unfair, a mean is fair

A raw sum grows just because you have more rows. Ten apartments will always "sum" to more error than four, even if the model is better. To compare fairly we divide by how many there are.


8. Square root and the percent sign — the last two costumes


9. Assembling the four scores — the symbols finally combine

Now that every block is defined, we snap them together. Read each formula left to right as a sentence built from the pieces above.

Recall How each formula decodes into blocks

MAE ::: mean + absolute of the residual . MSE ::: mean + square of the residual . RMSE ::: square-root wrapped around MSE. MAPE ::: mean + absolute + divide by + .


Prerequisite map

The diagram below shows how each foundation feeds the next and finally into the topic. In words: the true value and guess combine into the residual ; the residual then flows two ways — through absolute value or through squaring — both of which get piled up by the sum and turned into a per-sample average (). The absolute-value branch gives MAE; the squared branch gives MSE; feeding MSE through the square root gives RMSE; and taking the absolute branch, dividing by then scaling by gives MAPE. All four arrive at the parent topic.

true value y and guess y-hat

residual e = y minus y-hat

absolute value bars remove sign

square removes sign and punishes big misses

sum with sigma

average by dividing by n

MAE and MSE

square root undoes square

RMSE in readable units

divide by true value then times 100 percent

MAPE relative error

Regression metrics topic

When you meet a formula on the parent page, trace it back up this map — every symbol you see was defined above.


Equipment checklist

Self-test: can you say each answer before revealing it?

What do MAE, MSE, RMSE, MAPE stand for?
Mean Absolute Error, Mean Squared Error, Root Mean Squared Error, Mean Absolute Percentage Error.
What does the hat in mean?
An estimate/prediction of the true value .
What does the subscript in tell you?
It is an address pointing to sample number — not a power or multiplication.
Write the residual formula and say what a positive residual means.
; positive means the model guessed too low (undershot).
Why can't we just average the raw residuals ?
Positive and negative errors cancel, falsely making the model look perfect — so we remove the sign first.
Give two ways to make an error non-negative, and one extra thing squaring does.
Absolute value and squaring ; squaring also magnifies large errors and is smooth (no corner) for training.
What does literally expand to?
— a compact "" chain.
Why multiply the sum by ?
To turn a total into a per-sample average so datasets of different sizes compare fairly.
Why take the square root in RMSE?
To undo the squaring and return to the original, interpretable units.
Why does MAPE divide by , and when does it break?
To measure error relative to the true size; it breaks (undefined) when .
Write the full MAE formula from memory.
.