Skip to content

MAPE — Mean Absolute Percentage Error

\[ \text{MAPE} = \frac{100}{n} \sum_{i=1}^{n} \left| \frac{e_i}{y_{\text{true},i}} \right| \quad (y_{\text{true},i} \neq 0) \]

Implementation: sklearn.metrics.mean_absolute_percentage_error × 100 — sklearn returns a fraction (0.12), COREMat reports percent (12%).

Running example:

  1. Relative errors: \(|e_i / y_{\text{true},i}| = [1/5,\; 2/20,\; 5/50,\; 10/100,\; 20/200] = [0.20, 0.10, 0.10, 0.10, 0.10]\)
  2. Mean: \((0.20 + 0.10 + 0.10 + 0.10 + 0.10) / 5 = 0.60 / 5 = 0.12\)
  3. Result: \(\text{MAPE} = 0.12 \times 100 = 12.0\%\)

Interpretation

MAPE reports the average prediction error as a percentage of the true value. MAPE = 10 % means that, on average, predictions deviate by 10 % from the true value. Because errors are normalised by \(y_{\text{true}}\), MAPE is scale-free and comparable across datasets with different target units.

When to use

  • When relative accuracy matters more than absolute accuracy (e.g. predicting a property that spans a moderate range).
  • As a business-friendly metric because percentages are intuitive.

Disadvantages

  • Undefined where \(y_{\text{true},i} = 0\): those rows are masked out, and the result is NaN only if no row survives. Still explodes when \(y_{\text{true},i}\) is very small but non-zero.
  • Asymmetric: an over-prediction of ×2 gives 100 % error, but a corresponding under-prediction of ×0.5 gives 50 % error. Use SMAPE when symmetry is required.
  • Biased towards models that under-predict (lower \(y_{\text{pred}}\) cannot produce errors above 100 % relative to \(y_{\text{true}}\), but over-prediction can).

Compute cost

Low — single pass over predictions.


← Back to Metrics index