Library · Metric

WAPE: weighted absolute percentage error

WAPE, also called the MAD/mean ratio, is the total absolute error divided by the total demand. It stays defined when some periods are zero and is the percentage measure that survives a catalogue of slow items.

By , published

Definition

The weighted absolute percentage error sums the absolute errors and divides once by the sum of the actual values. Kolassa and Schütz describe it as the ratio of the mean absolute deviation to the mean.

WAPE = Σ |yt − ft| ÷ Σ |yt| × 100

It is the same as a MAPE in which each period is weighted by its actual value. The denominator is zero only if the whole window has no demand.

Worked example

Two items, one fast and one slow, are forecast for six periods. The slow item has zeros.

import numpy as np

fast_y = np.array([980, 1040, 1010, 955, 1020, 995]); fast_f = np.full(6, 1000.0)
slow_y = np.array([0, 2, 0, 1, 0, 3]);                slow_f = np.full(6, 1.0)

def wape(y, f):
    return 100 * np.abs(y - f).sum() / np.abs(y).sum()

def mape(y, f):
    keep = y != 0                              # MAPE must drop the zeros
    return 100 * np.mean(np.abs(y[keep] - f[keep]) / y[keep]), int((~keep).sum())

print(f"fast item  WAPE = {wape(fast_y, fast_f):5.1f}   MAPE = {mape(fast_y, fast_f)[0]:5.1f}")
m, dropped = mape(slow_y, slow_f)
print(f"slow item  WAPE = {wape(slow_y, slow_f):5.1f}   MAPE = {m:5.1f}  ({dropped} periods dropped)")
y, f = np.r_[fast_y, slow_y], np.r_[fast_f, slow_f]
print(f"both items WAPE = {wape(y, f):5.1f}")

Output, produced by running the code above when this page was built:

fast item  WAPE =   2.3   MAPE =   2.3
slow item  WAPE = 100.0   MAPE =  38.9  (3 periods dropped)
both items WAPE =   2.4

On the slow item, MAPE is computed on half of the periods only. WAPE uses all of them, and gives 100 to a forecast equal to the mean, the score that forecasting nothing would also get. Pooled over both items, WAPE is almost entirely the fast item: the slow one weighs a few units out of six thousand.

Where it misleads

The pooled figure is a volume-weighted score. A forecast can be poor on every slow item and still show an excellent WAPE if the few fast items are right. Report it by segment, for example by demand class, and not only for the whole catalogue.

Like every measure built on the absolute error, WAPE is minimised by the median. On a series that is mostly zeros it rewards a forecast of zero, exactly as MASE does, and a WAPE of 100 is what forecasting nothing achieves. It also cannot be averaged across items without choosing weights, which is the problem scaled errors were designed to solve.

In our work

For clients who need a percentage on their dashboards we use WAPE by demand class, never MAPE, and we print the WAPE of a zero forecast next to it as the line a method has to beat.

References

  1. Kolassa, S., Schütz, W. (2007). Advantages of the MAD/Mean ratio over the MAPE. Foresight: The International Journal of Applied Forecasting, 6, 40-43.
  2. Hyndman, R. J., Koehler, A. B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22(4), 679-688. doi:10.1016/j.ijforecast.2006.03.001
  3. Hyndman, R. J., Athanasopoulos, G. (2021). Forecasting: principles and practice, 3rd edition. OTexts, Melbourne. otexts.com/fpp3

Have a question like this one on your own data? Tell us what you need in a few lines.

Send us the brief

Related pages

  • MAPE: mean absolute percentage errorMAPE is easy to explain and is the measure most planning teams already report. It is undefined when the actual value is zero, it explodes on low volumes, and the forecast that minimises it sits below the mean.
  • MASE: mean absolute scaled errorMASE compares the absolute error of a forecast with the error a naive forecast made on the history. Below 1, the forecast beats that naive benchmark. On series that are mostly zeros, a forecast of zero gets the best score.
  • Demand classification: ADI and CV²Two numbers describe a demand series: how often it sells (ADI) and how much the order sizes vary (CV²). The cut-offs 1.32 and 0.49 split a catalogue into smooth, erratic, intermittent and lumpy items.
All library pages