Regression Metrics: MAE, MSE, RMSE, R²
It all starts with the residual
For regression, the raw material of every metric is the residual — the gap between what the model predicted and what actually happened.
residual = actual − predicted. A perfect model has all residuals at zero. Each metric is just a different way of summarising a whole pile of residuals into one number.
Build each metric from the errors
The animation takes five predictions, shows their residuals, then assembles MAE, MSE, RMSE, and finally R² one step at a time.
The four, compared
Average absolute error, in the target's units. Easy to read, treats all misses equally, robust to outliers.
Squares each error first, so big misses dominate. Units are squared — harder to interpret directly.
Square root of MSE — back in the target's units, but still penalises large errors heavily.
Fraction of variance explained vs just predicting the mean. 1 = perfect, 0 = no better than the average.
MAE vs RMSE — which to report?
- You want errors in plain units, equally weighted
- The data has outliers you don't want to dominate
- A miss of 10 is simply "twice as bad" as a miss of 5
- Large errors are disproportionately costly
- You're optimising a model that minimises squared error
- You want a metric sensitive to variance in errors
R² can be negative if the model is worse than guessing the mean. And a high R² doesn't guarantee good predictions — always look at RMSE/MAE in real units too.
Related
For classification, the metric family is different — see Confusion Matrix and Precision, Recall & F1. The residual idea here also underpins how Linear Regression is fit in the first place.