1. Definition
MAE measures the average magnitude of errors between predictions and actual values, without considering direction (positive/negative).
$MAE = \frac{1}{N} \sum_{i=1}^N |y_i – \hat{y}_i|$
where:
- $N$ = number of predictions
- $y_i$ = actual value
- $\hat{y}_i$ = predicted value
2. Intuition
- It tells us “on average, how far off are our predictions?”
- Errors are in the same units as the target variable (e.g., dollars, kWh, degrees).
- Unlike RMSE, it does not penalize large errors disproportionately.
3. Example
Suppose actual vs predicted electricity demand (in MW):
| Observation | Actual ($y$) | Predicted ($\hat{y}$) | Error $|y – \hat{y}|$ |
|---|---|---|---|
| 1 | 100 | 90 | 10 |
| 2 | 200 | 220 | 20 |
| 3 | 400 | 360 | 40 |
$MAE = \frac{10 + 20 + 40}{3} = 23.3$
→ On average, predictions are 23.3 MW off.
4. Properties
- Range: 0 → ∞
- Interpretability: Directly understandable (same units as target).
- Robustness: Less sensitive to outliers than RMSE.
- Limitation: Treats all errors equally, so large mistakes are not penalized more heavily.
5. Comparison with Other Metrics
- MAE: Average absolute deviation (linear penalty).
- RMSE: Penalizes larger errors more (quadratic penalty).
- MAPE: Error expressed as a percentage (relative scale).
- R²: Proportion of variance explained, not an absolute error.
Use MAE when you want a straightforward, interpretable average error.
Use RMSE when large errors are especially costly.
6. Python Example
from sklearn.metrics import mean_absolute_error
y_true = [100, 200, 400]
y_pred = [90, 220, 360]
mae = mean_absolute_error(y_true, y_pred)
print("MAE:", mae)
Output:
MAE: 23.3
Summary
- MAE = average of absolute differences between actual and predicted values.
- Range: [0, ∞], lower = better.
- Same units as target → very interpretable.
- Less sensitive to outliers than RMSE.
