WAPE (Weighted Absolute Percentage Error) | What it means and how to use it

中級

4.2.12

WAPE (Weighted Absolute Percentage Error) | What it means and how to use it

Last updated 2020-07-01 Read time 4 min
Summary
  • WAPE measures absolute error relative to the total actual volume.
  • Calculate WAPE on demand forecasts and see how it is reported in dashboards.
  • Understand instability when total volume is small and how to combine WAPE with MAE.
  • MAE & RMSE — understanding this concept first will make learning smoother
  • MAPE — understanding this concept first will make learning smoother

1. Definition #

$$ \mathrm{WAPE} = \frac{\sum_{i=1}^n |y_i - \hat{y}_i|}{\sum_{i=1}^n |y_i|} \times 100\% $$
  • Scales the absolute error by total actuals, making it comparable across items of different magnitude.
  • Unlike MAPE, it does not explode when individual actuals hover near zero.

2. Implementation in Python #

1
2
3
4
5
6
7
import numpy as np

def wape(y_true: np.ndarray, y_pred: np.ndarray) -> float:
    """Weighted Absolute Percentage Error."""
    return float(np.sum(np.abs(y_true - y_pred)) / np.sum(np.abs(y_true)))

print("WAPE:", round(wape(y_test, y_pred) * 100, 2), "%")

Guard against cases where the total actual volume is ~0: remove such segments or normalise by mean demand instead.


3. Comparing WAPE and MAPE #

MetricCharacteristicsCaution
MAPEMean percentage error per sampleDiverges when actual ≈ 0
WAPETotal absolute error ÷ total actual volumeHeavily influenced by high-volume items
sMAPEUses average of actual & predictedHandles zeros but harder to interpret

WAPE is popular in CPG/retail because it summarises overall demand accuracy without overemphasising low-volume SKUs.


4. Practical usage #

  • Inventory planning: track WAPE as a KPI (e.g., target WAPE ≤ 10%). Compare across regions or categories.
  • Model comparison: MAE depends on units, but WAPE (percentage) makes models comparable even across different scales.
  • Drill-downs: global WAPE can hide poorly performing SKUs—slice WAPE by brand, region, or segment.

5. Caveats #

  • If long periods have zero demand, compute WAPE only on active periods or switch to MAE.
  • Always evaluate on identical periods and item sets when comparing across time.
  • Complement with item-level MAE/MAPE to spot individual problem SKUs.

Summary #

  • WAPE expresses absolute error as a share of total demand, making it easy to communicate as a KPI.
  • It mitigates MAPE’s zero-demand blow-up, yet still needs MAE/other metrics for item-level diagnosis.
  • Combine overall WAPE with segmented views to prioritise improvement work.

FAQ #

What does WAPE mean? #

WAPE stands for Weighted Absolute Percentage Error. It measures forecast accuracy by summing all absolute errors and dividing by the total actual demand volume:

$$ \mathrm{WAPE} = \frac{\sum |y_i - \hat{y}_i|}{\sum |y_i|} \times 100\% $$

The “weighted” refers to weighting by volume: high-demand items naturally contribute more to the overall error, so WAPE reflects business impact better than a simple average of per-item percentage errors.

What is a good WAPE value? #

There is no universal threshold, but common industry benchmarks in demand forecasting are:

WAPETypical interpretation
< 10%Excellent
10–20%Good
20–40%Acceptable
> 40%Needs improvement

Context matters: stable, high-volume products should achieve lower WAPE than seasonal or promotional items. Always compare against a naive baseline (e.g., last period’s actuals) rather than an absolute target.

What is the difference between WAPE and MAPE? #

MAPE averages the percentage error per individual item:

$$ \mathrm{MAPE} = \frac{1}{n} \sum \frac{|y_i - \hat{y}_i|}{|y_i|} \times 100\% $$

WAPE pools errors across all items before dividing. Key consequences:

  • MAPE explodes when any individual actual is near zero; WAPE is stable as long as total volume is non-zero.
  • MAPE weights every item equally regardless of volume; WAPE weights high-volume items more heavily.
  • WAPE is preferred in retail/CPG for overall KPI reporting; MAPE is used when per-item accuracy is equally important regardless of size.

When should I use MAE instead of WAPE? #

Use MAE (Mean Absolute Error) when you need item-level diagnostics in the original unit (e.g., units, revenue). MAE does not depend on actual values being non-zero and is easy to interpret per SKU. WAPE gives a single relative number suitable for executive dashboards and cross-category comparisons. Use both together: WAPE for the headline KPI and MAE (or MAPE on positive-demand periods) for item-level root-cause analysis.

How do I handle zero demand in WAPE? #

When the denominator (total actual volume) is zero for a segment, WAPE is undefined. Practical solutions:

  • Exclude zero-demand periods from the calculation scope.
  • Segment separately: compute WAPE only on active SKUs, and track zero-demand separately as a coverage metric.
  • Switch to MAE for items or periods with intermittent demand (Croston’s method or ADIDA are designed for these cases).