4.2.3
MAE & RMSE
Summary
- MAE and RMSE measure regression error magnitude using absolute and squared formulations.
- Visualise how the two metrics react when prediction errors contain outliers.
- Summarise selection criteria—sensitivity to outliers, interpretability, and unit consistency.
1. Definitions and properties #
For observations \(y_i\) and predictions \(\hat{y}_i\):
$$ \mathrm{MAE} = \frac{1}{n} \sum_{i=1}^n |y_i - \hat{y}_i|, \qquad \mathrm{RMSE} = \sqrt{\frac{1}{n} \sum_{i=1}^n (y_i - \hat{y}_i)^2} $$- MAE averages absolute errors. It is more robust to outliers and corresponds to the median in a Laplace error model.
- RMSE squares errors before averaging, then takes the square root. Large deviations are penalised heavily.
- Both retain the original units of the target; RMSE emphasises large mistakes, MAE emphasises typical error size.
2. Computing in Python #
| |
Setting squared=False returns RMSE instead of MSE.
3. Effect of outliers #
| |
- MAE grows slowly when we introduce an outlier.
- RMSE increases sharply, highlighting large individual errors.
4. Choosing between MAE and RMSE #
- Few outliers and precision matters → choose RMSE to highlight subtle deviations.
- Many outliers or heavy-tailed noise → MAE (or median absolute deviation) stays stable.
- Costs scale quadratically → RMSE mirrors the business objective (e.g., energy loss, physical deviations).
- Need straightforward communication → MAE answers “on average we miss by ±X units”.
5. Related metrics #
- MAPE: percentage error; intuitive for business users but unstable near zero.
- RMSLE: RMSE on the log scale; punishes underestimation in growth/volume forecasts.
- Pinball loss: evaluates prediction intervals/quantiles for risk-sensitive forecasts.
Summary #
- MAE and RMSE complement each other; one is robust, the other sensitive to large errors.
- Report both to understand error distribution and pick the metric that matches your cost function.
- Combine with MAPE, RMSLE, or quantile losses to gain a richer view of model performance.