AI Glossary / Mathematics and optimization / Intermediate

Absolute error loss

Definition

Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|. It treats equally sized overestimates and underestimates equally. Averaging this loss across examples produces mean absolute error, commonly abbreviated MAE.

What it means

If a prediction is 12 and the reference value is 9, the absolute error is 3. A prediction of 6 also has error 3. Direction is removed, so opposite errors cannot cancel when the losses are averaged.

The loss retains the target's units: errors in minutes produce a loss in minutes. It is different from percentage error and from squared error. Increasing an absolute error from 2 to 4 doubles the loss; under squared error, the corresponding penalty rises from 4 to 16. That difference changes which predictions an optimization procedure favors.

How it works

Compute the residual between each prediction and its reference value, then take its magnitude. Aggregate losses using a mean, a weighted mean, or another explicitly named summary.

For a constant prediction, minimizing the sum of absolute deviations selects a sample median. More generally, under appropriate integrability conditions, minimizing expected absolute error targets a conditional median, whereas squared error targets a conditional mean.

As a function of the scalar prediction, absolute error is convex but has a corner at the reference value. Optimizers can use subgradients, linear programming formulations, or other suitable methods rather than assuming an ordinary derivative exists everywhere. Convexity in the prediction does not automatically make training a nonlinear model convex in its parameters.

Three practical examples

1. Delivery-time prediction: summarize the typical magnitude of errors in minutes, while separately examining whether predictions systematically run early or late.

2. Demand forecasting: compare numerical forecasts using unit-based errors when linear penalties are a reasonable approximation to the evaluation goal.

3. Sensor estimation: fit a central value with less sensitivity to extreme response values than a squared-error criterion, while still checking the data-generating process.

Think of it this way

Think of measuring how far each dart lands from a marked position along a line, counting distance without attaching a plus or minus sign. Missing by five units in either direction costs five.

The analogy assumes symmetric consequences and a linear penalty. In many real decisions, overshooting and undershooting have different costs. Absolute error does not express that asymmetry unless the loss is modified.

Worked example

Three observed values are 2, 3, and 10. Suppose one constant prediction must serve all three. Predicting the median, 3, gives absolute errors 1,0,7, totaling 8 and yielding MAE 8/3, approximately 2.667.

Predicting the mean, 5, gives errors 3,2,5, totaling 10 and yielding MAE 10/3, approximately 3.333. However, squared errors favor the mean: at 5 they total 9+4+25=38, compared with 1+0+49=50 at 3.

If the last observation changes from 10 to 100, the median remains 3, whereas the mean becomes 35. Absolute-error fitting of this constant retains its median solution. Its achieved loss still increases substantially, so robustness of the fitted center does not mean large errors disappear from evaluation.

For an even-sized sample, a whole interval between the two middle observations can minimize total absolute error. A median-based optimum therefore need not be unique.

Illustrative case study

Fictional case: a repair business predicts completion times. Its analysts compare models using MAE because staff can interpret the result directly in hours.

The lowest-MAE model occasionally produces a very large underestimate. The team adds tail-error summaries and inspects signed residuals before deciding how estimates should be communicated. It also separates repair categories so that frequent short jobs do not hide poor performance on rarer long jobs.

The final report treats MAE as one useful view of performance. It does not translate an average error directly into a guarantee for an individual job or assume that all errors have equal business consequences.

Common misconceptions and mistakes

Absolute error and absolute percentage error are different. The latter divides by a reference value and has additional issues near zero; ordinary absolute error does not perform that division.

MAE is the mean of absolute errors, not the absolute value of the mean signed error. The latter can hide large errors through cancellation.

Reduced sensitivity to extreme response errors does not mean complete immunity to outliers. Unusual input values with high leverage can still affect regression fits.

Do not assume that a small MAE transfers across datasets with different units, scales, or case mixes. Comparisons require compatible evaluation conditions.

Business use

Absolute error offers a straightforward operational measure when the size of a miss matters approximately linearly and both directions have similar costs. Its original units can make model comparisons easier to explain.

Check whether the actual decision requires asymmetric costs, a service-level target, or special attention to extreme misses. Report the aggregation rule, units, sample count, and relevant subgroup results. If predictions cover multiple outputs with different units, avoid averaging their errors without an explicit scaling or weighting rationale.

People also ask

Can absolute error be negative?

No. It is nonnegative and equals zero when the prediction matches the reference value.

Is the best constant prediction always the mean?

No. Under absolute error, a median minimizes the total loss; the mean is associated with squared error.

Does MAE describe a confidence interval?

No. It is an average loss statistic, not a calibrated interval or a guaranteed bound on individual errors.

Check your understanding

Two predictions have signed errors +6 and -6. What are their mean signed error and MAE?

Answer: The mean signed error is zero, but the MAE is (6+6)/2=6. Taking magnitudes before averaging prevents cancellation.

Related terms

  • Mean Absolute Error
  • Median
  • Residual
  • Quantile Regression
  • Subgradient
  • Robust regression
  • least absolute deviations
  • squared error
  • asymmetric loss

Learn next

Plot total absolute error for several constant predictions on a small dataset and locate the median minimizers. Compare with the squared-error curve and its mean minimizer. Next study quantile loss to understand how unequal penalties for overprediction and underprediction change the target.

  • Absolute error
  • Median

More in Mathematics and optimization

  • 0/1 loss - The 0/1 loss assigns zero to a correct classification and one to an incorrect classification.
  • 3D projection - 3D projection is the mathematical mapping of three-dimensional points or objects onto a two-dimensional surface, such as a screen or image plane.
  • Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
  • Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
  • Σ-algebra
  • Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.

Sources

Primary glossary entry read: The Aalto Dictionary of Machine Learning, absolute error loss: https://aaltodictionaryofml.github.io/ADictML_Main.pdf . Official MAE documentation read for aggregation and multioutput conventions: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_absolute_error.html . The constant-fit examples are original hand calculations, not model-training experiments.

Previous: Absolute error Next: Absolute frequency

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer