- Introduced by
- Pierre-Simon Laplace
- Year
- 1799
- Type
- Robust distance-based metric
- Family
- Error metric
What does it do?
Mean Absolute Error (MAE) is a metric for regression models that averages the absolute differences between observed and predicted values.
Because it is expressed in the units of the target variable, it gives a direct reading of the typical size of a prediction error. A single MAE value is best interpreted against a baseline and against domain tolerances.
The intuition behind the method
MAE weights every residual by its absolute size, so an error of 10 units contributes twice as much to the average as an error of 5 units. The sign is ignored, so an over-prediction and an under-prediction of the same size count equally. Because each residual enters linearly, a single very large error raises the average in proportion to its size rather than to its square, which is why MAE is less dominated by a few extreme points than squared-error metrics. An MAE of 5 means that, averaged over the observations, predictions differ from the actual values by 5 units. Whether 5 units is good or poor depends on the scale of the target and on a baseline comparison.
History
Absolute-error criteria have a long history in statistics; Pierre-Simon Laplace's 1799 Traité de Mécanique Céleste is sometimes cited in connection with them, but this page does not rely on it to establish who introduced MAE as an evaluation metric, and no definitive originator is claimed. The label 'L1' is later terminology. Huber and Ronchetti's Robust Statistics is a general text on robust estimation and is useful background on why absolute-error criteria are studied as robust alternatives to squared error.
When to use it
Choose MAE when the regression task should penalise errors in proportion to their size, and when a few large errors should not dominate the evaluation, for example when the data contain outliers that you do not want to drive the metric. It is a natural choice when an error of a given size costs the same whichever direction it goes. Do not choose MAE as the sole criterion when large errors are disproportionately costly, because the linear weighting will understate them relative to squared-error metrics. Be aware that some textbooks recommend RMSE over MAE because it is more pessimistic about model performance; reporting both is a reasonable practice. Also be cautious when optimising a model with a gradient-based method, since the absolute value is not differentiable at zero residual; the metric is then best used for evaluation or with solvers designed for it. How to read the result: an MAE value cannot be judged in isolation. Compute it on held-out data, express it in the target's units, and compare it with the MAE of a simple baseline on the same data, such as always predicting the training mean or median, or a naive forecast. Then judge it against the error tolerance that matters in the application domain.
Limitations and considerations
- The absolute value is not differentiable at zero residual, so gradient-based fitting needs special handling near zero.
- Minimising MAE favours the conditional median of the target rather than its conditional mean, so models trained on it can behave differently from least-squares fits.
- Because the weighting is linear, MAE does not reflect cost structures in which large errors are disproportionately expensive.
- The value is scale-dependent, so MAE values from targets measured in different units cannot be compared directly without normalisation.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Errors are weighted linearly, so a few extreme residuals do not dominate the average as they would under squared-error metrics.
- The result is expressed in the units of the target variable, so the value can be read directly as an average deviation.
- Over- and under-predictions of equal size contribute equally, which matches decisions where the cost is symmetric.
- Computation requires only a single pass over the residuals.
Applications
- Supply chain demand forecasting, where the average absolute deviation of predicted demand from actual sales is measured with equal weight on over- and under-forecasts.
- Travel-time or arrival-time prediction, where errors are expressed in minutes and early and late predictions are treated symmetrically.
- Sensor calibration, where the average offset of a measuring device is reported in the physical unit of the quantity measured.
- Inventory management, where the typical error in predicted stock levels is summarised in stock units.
- Energy load forecasting, where the average prediction error is reported in the energy unit used for grid planning.
How it works
How it works
For each observation, compute the residual: the actual value minus the predicted value. The sign shows the direction of the error.
Formula
e_i = y_i - \hat{y}_iTake the absolute value of each residual, discarding its sign so that over- and under-predictions contribute the same way.
Formula
\left| e_i \right| = |y_i - \hat{y}_i|Sum the absolute errors over all n observations and divide by n to obtain the mean absolute error, which is in the same units as the target.
Formula
MAE = \frac{1}{n} \sum_{i=1}^{n} |y_i - \hat{y}_i|Common pitfalls
- Confusing MAE with RMSE when selecting a metric: because RMSE penalises large residuals more heavily, the two can rank the same models differently.
- Fitting a model with one criterion and then judging it with the other; if the model was optimised for MAE, its RMSE is not the quantity it was tuned for, and vice versa.
- Reading a lower MAE as evidence that the model is better on the errors that matter most, when the largest residuals may be the costly ones and MAE gives them only linear weight.
- Judging an MAE value without a baseline or domain knowledge; the same number can be excellent for one target and poor for another.
- Treating 'mean absolute deviation' as a synonym: that name often refers to the average deviation of observations from their own mean or median, which is a different statistic from the error between predictions and actual values.
Frequently asked questions
When should I use MAE instead of RMSE?
Use MAE when errors should be weighted in proportion to their size and when outliers should have limited influence on the metric. Use RMSE, or another squared-error criterion, when large errors are disproportionately costly, because squaring gives them more weight.
Why is MAE harder to optimise than RMSE?
The absolute value has a kink at zero, so its derivative is undefined there, while the squared error is smooth everywhere. Gradient-based methods therefore need subgradients or specialised solvers for MAE.
Can I use MAE as a loss function in neural networks?
Yes, MAE is used as a loss function, often called L1 loss. It is a reasonable choice when outliers are expected, but its gradient is discontinuous at zero residual, and many frameworks provide dedicated implementations for it.
How does MAE respond to outliers compared with RMSE?
MAE grows linearly with each residual, whereas RMSE squares each residual before averaging and then takes a square root. A single very large error therefore has a proportionally smaller effect on MAE than on RMSE, which is why MAE is less sensitive to outliers. The exact change in either metric depends on the number of observations.
How do I compare MAE values across datasets?
Raw MAE values depend on the scale of the target, so they are not comparable across targets measured in different units. One option is to divide MAE by a scale measure of the target, such as its mean, giving a scale-free ratio. Mean absolute percentage error is a different measure: it divides each absolute error by the corresponding actual value before averaging, so it is not the same as dividing MAE by the mean.
Related methods
Sources
Laplace, P. S. (1799). Traité de Mécanique Céleste. Paris: J.B.M. Duprat.
Open publication referenceBrossier, C. L. (1999). Consistency of trimmed and Winsorized L-estimators of location and scale. Journal of the American Statistical Association, 74(368), 813-821.
Open publication referenceHuber, P. J. (2009). Robust Statistics (2nd ed.). Hoboken, NJ: John Wiley & Sons.
ISBN: 978-0470129906Kelleher, Mac Namee & D'Arcy, Fundamentals of Machine Learning for Predictive Data Analytics, p. 506