Mean Absolute Percentage Error (MAPE)
1) Definition
MAPE measures the average size of prediction errors as a percentage of the actual values. It expresses model accuracy in a scale-free, intuitive way (percent error).
Formula:
$\text{MAPE} = \frac{100\%}{n} \sum_{i=1}^{n} \left| \frac{y_i – \hat{y}_i}{y_i} \right|$
- $y_i$ = actual value
- $\hat{y}_i$ = predicted value
- $n$ = number of observations
2) Interpretation
- Output: a percentage (%).
- Example: A MAPE of 8% means predictions are off by 8% on average.
- Lower is better: Smaller percentage error = better model fit.
3) Example
Suppose we predict product demand:
| Observation | Actual ($y$) | Predicted ($\hat{y}$) | Error $|y-\hat{y}|$ | % Error = $\frac{\lvert y – \hat{y} \rvert}{y} \times 100\%$ |
|---|---|---|---|---|
| 1 | 100 | 90 | 10 | 10% |
| 2 | 200 | 220 | 20 | 10% |
| 3 | 400 | 360 | 40 | 10% |
$\text{MAPE} = \frac{10\% + 10\% + 10\%}{3} = 10\%$
Interpretation: On average, the model is 10% off from actual demand.
4) Strengths
- Scale-independent: Can compare accuracy across datasets with different scales.
- Easy to interpret: Percentages are intuitive for business stakeholders.
- Directly linked to KPIs: Helps businesses understand error impact in relative terms.
5) Limitations
- Division by zero: If any $y_i = 0$, the formula breaks.
- Fixes: add a small constant, or use sMAPE (Symmetric MAPE).
- Asymmetry: Over-predictions and under-predictions can have uneven effects.
- Bias towards small actuals: When actual $y_i$ is small, even tiny absolute errors produce very large percentage errors.
- Not always aligned with business cost: A 10% error in predicting 10 units vs 10% error in predicting 10,000 units may not have the same real-world impact.
6) Variants
- sMAPE (Symmetric MAPE):
- $\text{sMAPE} = \frac{100\%}{n} \sum_{i=1}^{n} \frac{|y_i – \hat{y}_i|}{(|y_i| + |\hat{y}_i|)/2}$
- Fixes the zero-division problem and makes errors more balanced.
- WAPE (Weighted Absolute Percentage Error):
- $\text{WAPE} = \frac{\sum |y_i – \hat{y}_i|}{\sum |y_i|}$
- Weighted by actual demand volume, so big items matter more.
7) When to use
- Good for forecasting tasks (demand prediction, sales forecasting, energy consumption).
- Useful when communicating with non-technical stakeholders, since percentage errors are easy to understand.
- Best when there are no zeros or near-zeros in the data.
Summary:
MAPE is the average percentage error between predicted and actual values. It’s intuitive and scale-free but has issues with zeros and small denominators. Alternatives like sMAPE and WAPE are often used in practice to address these problems.
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
