← All AI/ML articles

Regression metrics, visualised.

“How good is my model?” has several answers. See MAE, MSE, RMSE and R² drawn right on the data, and learn which one to trust when.

1. Pick a metric2. Move the line3. See what it measures
Click empty space to add a point · drag a point to move it · double-click to remove it. The bar shows how much of the data’s variation the line explains (R²).
Behind the scenes · 1

Everything starts from the errors

For every point, error = prediction − real value. The four metrics are just four different ways of summarising that same column of errors.


MAE averages the absolute errors. MSE averages the squared errors. RMSE is the square root of MSE. R² compares the squared errors with those of the laziest model: always predicting the average.

Behind the scenes · 2

What one bad point does

A new point appears at x = 8, this far from your line. Drag the slider and compare how each metric reacts. Squaring makes big errors count far more.


Behind the scenes · 3

Units matter

Imagine y is a length. Change the unit it is measured in and watch the metrics. MAE and RMSE keep y’s unit, MSE lives in squared units, and R² has no unit at all.


Same model, same errors, but MSE changed by a factor of 1,000,000 while R² did not move. That is why R² (or a percentage error) is used to compare across different datasets.

Behind the scenes · 4

When a good score hides a bad model

Metrics squeeze all errors into one number. A residual plot shows the errors themselves. If they look like random scatter, the line is the right shape. If they form a curve, the model is missing something, even when R² looks high.


Each dot is one point’s error (ŷ − y). The centre line is zero error.

Practical

Which one should I use?

MAE

Easy to explain: “we are off by about 3 on average”. Not dominated by a few extreme misses.

RMSE

Same unit as y, but punishes large misses harder. Use it when big errors are especially costly.

MSE

Smooth and easy to optimise, so it is the usual training loss. Harder to read because of squared units.

R²

Unit-free score against the “always guess the mean” baseline. Great for comparing, but check residuals too.

Experiment

Try it yourself

One extreme point

Push an outlier far away and compare MAE with MSE.

Worse than guessing

Tilt the line the wrong way and watch R² go negative.

Curved data, straight line

R² still looks high, but the residual plot shows a clear curve.

Change the units

Switch to millimetres and see which metrics explode.

Check yourself

Three quick questions

Key takeaways

  • MAE is the average size of the misses, in y’s own units.
  • MSE and RMSE square the misses first, so large errors dominate. RMSE is MSE in y’s units again.
  • RMSE is never smaller than MAE; a big gap means a few large errors.
  • R² compares your model with predicting the mean: 1 is perfect, 0 is no better, below 0 is worse.
  • Always look at the residuals: a single number cannot show a wrong-shaped model.
← Back to all articles