Mean absolute error (MAE) is a regression metric that measures the average absolute difference between predicted and actual values, expressed in the same units as the target variable. In model evaluation for artificial intelligence and machine learning, MAE answers a direct question: how far off is a typical prediction, ignoring whether the error is too high or too low.
Because every error contributes in proportion to its size, MAE is robust to outliers compared with squared-error metrics and easy to explain to non-specialists. It is widely used in demand forecasting, price estimation, energy load prediction and any task where a numeric target must be predicted and errors carry a roughly linear cost.
How mean absolute error is calculated
MAE is computed by taking the absolute value of each residual and averaging those values over all evaluated examples. For n observations with actual values y and predictions ŷ, the formula is MAE = (1/n) × Σ |y_i − ŷ_i|, which produces a single non-negative number where zero means perfect predictions.
The absolute value removes the sign, so overpredictions and underpredictions cannot cancel each other out. A model that is 10 units too high on one example and 10 units too low on another has an MAE of 10, while the simple mean error would misleadingly report zero. The worked calculation below shows how individual residuals combine into the final score.
| Example | Actual value | Predicted value | Absolute error |
|---|---|---|---|
| 1 | 120 | 110 | 10 |
| 2 | 80 | 86 | 6 |
| 3 | 200 | 195 | 5 |
| 4 | 150 | 171 | 21 |
| 5 | 95 | 93 | 2 |
| Mean | – | – | 8.8 |
The resulting MAE of 8.8 units means the model misses by about nine units on an average example. This direct interpretability is the main reason MAE is preferred in business reporting and stakeholder communication.
Statistical properties and what MAE optimizes
MAE has a precise statistical meaning: the constant prediction that minimizes MAE is the median of the target distribution, not the mean. A model trained to minimize absolute error, sometimes called L1 loss, therefore learns conditional medians, which makes it a natural fit for skewed targets such as delivery times or insurance claims.
This property explains its robustness to outliers. A single extreme error increases MAE linearly, whereas in mean squared error the same error is squared and can dominate the whole score. The trade-off is that MAE does not penalize large errors disproportionately, so it can hide rare but costly failures.
As a training objective, L1 loss has a non-differentiable point at zero error and a constant gradient magnitude, which can slow convergence near the optimum. Practitioners often use the Huber loss or the smooth L1 loss for training and still report MAE for evaluation.
MAE compared with other regression metrics
MAE is one of several regression metrics, and each one encodes a different view of error cost. Mean squared error and root mean squared error emphasize large mistakes, while percentage-based metrics normalize errors by the size of the actual value. The table summarizes the differences.
| Metric | Units | Sensitivity to outliers | Optimal constant prediction |
|---|---|---|---|
| Mean absolute error | Same as target | Low | Median |
| Mean squared error | Target units squared | High | Mean |
| Root mean squared error | Same as target | High | Mean |
| Mean absolute percentage error | Percent | High near zero targets | Weighted median |
| Coefficient of determination | Unitless | High | Mean |
A useful diagnostic is the ratio of RMSE to MAE. RMSE is always greater than or equal to MAE; when the two values are close, errors are fairly uniform, and when RMSE is much larger, a few large errors dominate and deserve error analysis.
Choosing and interpreting MAE in practice
MAE is the right choice when the cost of an error grows linearly with its size and when a typical-case summary is more useful than a worst-case one. It is less suitable when large errors are disproportionately harmful, as in safety margins or financial risk limits.
An MAE value means little without context. It should be compared against a baseline model, such as predicting the training median or using the previous period value in forecasting, and reported alongside the scale of the target. The decision table below lists typical situations.
| Situation | Recommended metric | Reason |
|---|---|---|
| Inventory forecasting with linear costs | MAE | Each unit of error costs about the same |
| Targets with heavy-tailed outliers | MAE or median absolute error | Limits the influence of extremes |
| Large errors are dangerous | RMSE or maximum error | Penalizes rare big misses |
| Comparing series of different scales | Scaled MAE or MASE | Removes dependence on units |
| Explaining results to managers | MAE with a baseline | Easy to read in native units |
Limitations and common mistakes
MAE is simple, but several pitfalls lead to wrong conclusions. The most frequent is comparing MAE across datasets with different scales, which is meaningless because the metric inherits the units and magnitude of the target.
- Ignoring the baseline: an MAE of 5 may be excellent or useless depending on what a naive model achieves.
- Averaging over heterogeneous segments: a low overall MAE can hide poor performance on small but important groups.
- Evaluating on leaked data: computing MAE on examples seen in training reflects overfitting rather than real accuracy.
- Reporting MAE without variance: a single number from one validation split can shift noticeably with cross-validation.
A final subtlety concerns transformed targets. If a model predicts the logarithm of a price, MAE in log space is not MAE in currency units, and the evaluation should convert predictions back to the original scale before reporting.
Understanding it simply
Imagine checking a weather app every day for a month and writing down how far its temperature forecast was from the real temperature, ignoring whether it guessed too warm or too cold. Some days it misses by one degree, other days by four.
If you add up all those misses and divide by the number of days, you get the mean absolute error. It tells you, in plain degrees, how wrong a typical forecast is. A smaller number means the predictions are closer to reality, and one unusually bad day does not distort the picture very much.
Applied in practice
A regional grocery chain builds a model to predict daily sales of fresh bread for each of its 60 stores, so that bakeries can bake the right amount each morning. Over-baking wastes product and under-baking loses sales, and in both cases the cost per loaf is roughly the same.
The analytics team evaluates the model on the last eight weeks of data held out from training. The naive baseline, which predicts the same weekday from the previous week, has an MAE of 46 loaves per store per day. The new gradient-boosted model reaches an MAE of 31 loaves, while its RMSE of 52 shows that a few holiday days still produce large misses.
The team reports that the model cuts the typical daily error by about one third, adds a holiday adjustment to address the remaining large errors, and tracks MAE weekly to detect distribution shift when store traffic patterns change.