MedAE — Median Absolute Error¶
\[
\text{MedAE} = \text{median}(|e_1|, |e_2|, \ldots, |e_n|)
\]
Implementation: sklearn.metrics.median_absolute_error.
Running example:
- Absolute errors: \(|e_i| = [1, 2, 5, 10, 20]\)
- Sorted: \([1, 2, 5, 10, 20]\) — middle value (n=5) is at position 3
- Result: \(\text{MedAE} = 5.0\)
Interpretation¶
MedAE reports the typical absolute error: half of all predictions fall within this distance of the true value. Because the median is insensitive to extreme values, a handful of very large errors do not inflate MedAE.
When to use¶
- When the error distribution is heavy-tailed or contains a few extreme outliers.
- When you want to characterise the performance for the majority of Samples rather than the worst cases.
- As a complement to MAE/RMSE to detect whether errors are uniformly distributed or dominated by a few outliers.
Disadvantages¶
- Ignores information about large errors entirely; a model that occasionally fails catastrophically can still have a low MedAE.
- Not differentiable, making it unsuitable as a training loss.
Compute cost¶
Low — requires sorting, O(n log n).