Interactive statistics

56 free interactive lessons: from mean and median to A/B tests and Bayes. Drag the charts and build intuition. No sign-up.

Module 7: Relationships & regression

Regression quality metrics: MAE, RMSE, MAPE

We know how to draw the line. But any forecast misses — the question is by how much. To compare models and know whether to trust them, the error is rolled up into a single number. There are several such numbers, and they answer different questions. Drag the points and add an outlier — watch how each metric reacts.

MAE
1.7
average |error|
RMSE
1.9
punishes outliers
MAPE
4%
error in %
0.99
share explained

Drag the points and watch the metrics. RMSE is always ≥ MAE and reacts to an outlier more sharply.

Each point has a residual — its distance to the line (the yellow ticks). All quality metrics are different ways to average these misses into one number. The smaller it is, the more accurate the model.

What it means

In practice the metric is fixed before training the model — otherwise there is a temptation to pick the one where the result looks prettier. And you watch more than one: MAE and RMSE side by side immediately show whether the data has heavy outliers (if RMSE is noticeably larger than MAE — it does).

These same metrics drive model selection in machine learning: out of a dozen models you take the one with the smaller error on new data. And what exactly counts as "error" — MAE, RMSE or something else — is determined by the business meaning of the task.

Where it shows up

Forecasting weather, demand, prices, travel time — quality is measured exactly this way everywhere. A delivery service optimizes the RMSE of predicted time: better to be consistently off by a couple of minutes than occasionally by half an hour.

Financial and product forecasts are often judged in MAPE: "the model is off by 8% on average" is clear to management and analysts alike, and does not depend on the units.

Definitions
MAEmean of |yᵢ − ŷᵢ|
the average absolute miss, in units of y. Simple and robust to outliers.
RMSE√(mean of (yᵢ − ŷᵢ)²)
the root of the mean squared error. Punishes large misses harder; always ≥ MAE.
MAPEmean of |yᵢ − ŷᵢ| / |yᵢ|
the average error in percent of the actual. Handy across scales, but dangerous near zero.
R² (determination)1 − SSres / SStot
the share of y's spread explained by the model: 1 — ideal, 0 — no better than the mean.
When the method lies (assumptions)

MAPE explodes on values near zero and is asymmetric: under- and over-forecasting are fined differently. For metrics with zeros (daily demand, rare orders) take MAE/RMSE or weighted variants.

R² grows from adding any variables and says nothing about performance on new data. A high R² with a nonlinear relationship, or when extrapolating beyond the training range, is an illusion of accuracy.

Next →
Enjoying the materials?

This site is built by the DataSlice Telegram channel: data analytics in plain words — real cases, metrics, careers. The channel is in Russian.

Open the Telegram channel