Statistics
Mean absolute error
stats.maeAlso called mean absolute error, mae, l1 loss, absolute error
Average of the absolute differences between observed and predicted values.
Notation
observed values
y ∈ ℝn
predicted values
ŷ ∈ ℝn
number of observations
Size, at least 1
Result: the mean absolute error
scalar
Worked examples
Each result is solved exactly and confirmed by two independent computations.
Given
Result
Given
Result
≈ 1.25
Given
Result
Common mistakes
Sums instead of averaging
The absolute errors are summed, giving n times the mean.
Fix: Divide by n.
Missing absolute value
Signed errors are averaged, so positive and negative errors cancel (this is the mean bias).
Fix: Take the absolute value of each difference before averaging.
Source
Murphy 2022
Murphy, Kevin P. Probabilistic Machine Learning: An Introduction. MIT Press, 2022.