AI Glossary / Causal inference and experimentation / Beginner

Max error

Definition

Max error is the largest absolute difference between a prediction and its observed target in an evaluated dataset. For scalar regression outputs, it is calculated as max |target − prediction| across the examples. It identifies the worst observed prediction miss in the target's units. It is an empirical summary of a particular sample, not a guarantee that future errors will remain below that value or a mathematical bound on every possible input.

What it means

An average error can look small while one prediction is badly wrong. Max error draws attention to that largest miss. It treats overprediction and underprediction symmetrically because the absolute value removes the sign.

The measure answers a narrow question: how far off was the most inaccurate prediction among the evaluated cases? It does not describe how frequently large errors occur, whether the remaining predictions are accurate, or why the worst case happened. Those questions need additional summaries and inspection. Its value can be strongly affected by a single unusual observation, an incorrect reference value, or the size and composition of the evaluation sample.

How it works

Align each prediction with its correct target. Compute the signed residual, take its absolute value, and find the largest value. Retain the identity and context of the example that produced it so the score can lead to useful investigation.

Use held-out or otherwise appropriate evaluation data when assessing prediction performance. A maximum calculated on training data describes that fitted sample and may conceal much larger errors elsewhere.

For several output quantities, define the intended aggregation and units before combining errors. Taking the maximum across meters, minutes, and temperatures is not automatically meaningful. The scikit-learn metric referenced by the supplied term concerns single-output regression, so broader uses require an explicit extension rather than an assumed default.

Three practical examples

1. Arrival estimates: a transport team reports the largest observed absolute timing miss alongside typical error and the number of unusually late predictions.

2. Measurement reconstruction: engineers identify the test record with the greatest discrepancy between reconstructed and reference sensor values for focused review.

3. Model regression checks: developers compare worst observed errors on a fixed benchmark to detect a change that leaves average quality similar but damages a particular case.

Think of it this way

Think of recording the widest gap between a measured length and its estimate in a box of samples. That gap identifies the largest observed miss in the box. The analogy is limited because the next box may contain a larger one. The sample maximum is not an assurance about every future object, and it says little about how often near-maximum misses occur.

Worked example

Suppose actual values are [10, 12, 15, 20] and predictions are [11, 10, 14, 27]. Absolute errors are [1, 2, 1, 7]. Max error is therefore 7, while mean absolute error is (1 + 2 + 1 + 7)/4 = 2.75.

A second model has absolute errors [3, 3, 3, 3]. Its max error is 3, but its mean absolute error is 3. Thus the second model improves the worst observed miss while worsening the average absolute miss on this sample.

If a new case with absolute error 9 is added to the first model's evaluation, its max error becomes 9. The earlier result was not false; it described a smaller set of observations. Reporting the sample alongside the metric keeps that interpretation clear.

Illustrative case study

Fictional case: Aspen Estimates changes a prediction model and sees almost no movement in average error. A max-error check identifies one unusually large mistake on a particular input format. Investigation reveals that the new preprocessing handles a unit field incorrectly for that format.

The team corrects the issue and adds representative cases to its evaluation collection, while recording that the collection has changed. It continues to monitor average error and tail behavior rather than making the maximum the sole success criterion. The fictional case shows how a worst-case observation can reveal a concrete defect without turning a finite test result into a universal promise.

Common misconceptions and mistakes

Do not call max error a guaranteed upper bound for deployment. It is only the largest error observed in the evaluated sample unless a separate proof establishes something stronger.

Do not use the largest signed residual when the intended metric is the largest absolute residual. A severe underprediction can otherwise be overlooked.

Avoid comparing maxima from very different sample sizes or conditions without qualification. Also avoid removing the worst example solely because it makes the score unattractive. Investigate whether it is a valid, relevant observation and document any defensible exclusion.

Business use

Max error is useful when a single severe miss may expose an important failure mode. It directs attention to examples that deserve review and can complement broader measures in a model-quality report.

Business teams should define the evaluated population, time period, units, and handling of invalid reference values. Pair the maximum with measures of typical error and the frequency of large misses. Where a service must satisfy an error limit, evaluate the actual requirement rather than assuming the observed maximum proves compliance on all future cases. The metric provides a diagnostic starting point, not the complete assurance argument.

People also ask

Is max error always nonnegative?

Yes, when defined from finite absolute residuals. Zero means every evaluated prediction exactly matches its target.

Can adding more evaluation cases reduce the maximum?

Not if the existing cases and predictions remain unchanged. The maximum stays the same or increases.

Does a smaller max error imply a smaller average error?

No. A model may reduce its worst miss while making many other predictions less accurate, as the worked example shows.

Check your understanding

Signed residuals are −12, 4, and 7 units. What is max error?

Answer: 12 units. The absolute residuals are 12, 4, and 7, so the negative sign of the largest miss does not hide it from the metric.

Related terms

  • Residual
  • Mean Absolute Error
  • Mean Squared Error
  • Root Mean Squared Error
  • Test set
  • Outlier
  • tail error
  • regression

Learn next

Compute absolute residuals for a small prediction set and identify the worst case. Compare max error with mean absolute error, then inspect the worst case's input and reference value. Add a new difficult example and explain why the sample maximum changes without implying that the model itself changed.

  • Mean Absolute Error

More in Causal inference and experimentation

  • Log likelihood ratio - A log likelihood ratio compares how well two statistical models or hypotheses account for the same observed data by taking the logarithm of their likelihood...
  • Longitudinal modified treatment policy - A longitudinal modified treatment policy, or LMTP, defines interventions over time that can modify the treatment value that would naturally arise at each...
  • Longitudinal targeted maximum likelihood estimation - Longitudinal targeted maximum likelihood estimation, or LTMLE, is a framework for estimating specified causal quantities from data containing treatment...
  • METEOR - METEOR is an automatic text-evaluation metric developed for machine translation.
  • Metric - A metric is a defined quantitative measure used to describe or compare some property of an AI system, dataset, process, or outcome.
  • Metric space - A metric space is a set of objects together with a distance function that satisfies four rules: nonnegativity, zero distance exactly for identical objects...

Sources

Primary implementation source: scikit-learn, Max error, https://scikit-learn.org/stable/modules/model_evaluation.html#max-error . The maximum-absolute-residual formula and single-output scope were consulted. This entry emphasizes the distinction between an observed sample maximum and a guaranteed bound. All numerical arrays and the fictional preprocessing case are original teaching illustrations rather than product measurements.

Previous: MAUVE (metric) Next: Max norm

  • 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