Library · Demand and stock

How to evaluate a demand forecasting vendor

A proof of concept shows an accuracy figure. The figure means something only if the test was set up so that the vendor could fail. These are the questions that separate the two cases, and a script to check the answers on your own data.

By , published

Eight questions

  • Which data did the model see? Give the vendor the history up to a date and keep the rest. A test on data the vendor already holds is not a test, see the sealed test set.
  • What was fixed before the test window was scored? The model, its settings and the measure should be written down first. A measure chosen afterwards is chosen to win.
  • Against what? Ask for the same score for a naive forecast, a moving average and your current forecast, on the same items and dates.
  • Which measure, and why that one? MAPE drops the periods without sales. A measure built on absolute errors can be won by forecasting too little, see MASE.
  • What is the bias? A forecast that is 15 % too high costs stock every month, whatever its accuracy.
  • How wide is the uncertainty on the gain? A gain of 3 % measured on two months and 200 items may be noise. Ask for the interval.
  • Where does it lose? Every method is worse than the baseline on some items. A vendor who can show which ones has looked.
  • What happens to stock? If the forecast feeds replenishment, ask for the service and stock obtained, not only the error, see accuracy and inventory performance.

A script for the proof of concept

The script takes three tables with one row per item: the history given to the vendor, the actual demand of the test window, and the vendor's forecast. Here the data are simulated, and the vendor's forecast is a noisy copy of a twelve-month average.

import numpy as np

rng = np.random.default_rng(35)
items, months, h = 400, 36, 6
mean = rng.gamma(2.0, 10.0, items)
history = rng.poisson(mean[:, None], (items, months))
actual = rng.poisson(mean[:, None] * 1.05, (items, h))           # demand grew 5 % in the test window
vendor = history[:, -12:].mean(1, keepdims=True) * rng.lognormal(0, 0.10, (items, 1)) * np.ones((1, h))

baselines = {
    "last month (naive)": np.repeat(history[:, -1:], h, axis=1),
    "12-month average": np.repeat(history[:, -12:].mean(1, keepdims=True), h, axis=1),
}
scale = np.sqrt(np.mean(np.diff(history, axis=1) ** 2, axis=1))
rmsse = lambda f: np.sqrt(np.mean((actual - f) ** 2, axis=1)) / scale
bias = lambda f: 100 * (f.sum() - actual.sum()) / actual.sum()

v = rmsse(vendor)
print(f"vendor              RMSSE = {v.mean():.3f}   bias = {bias(vendor):+.1f} %")
for name, f in baselines.items():
    b = rmsse(f)
    draws = rng.integers(0, items, (2000, items))                # resample items, same draw for both
    lo, hi = np.percentile([v[i].mean() / b[i].mean() - 1 for i in draws], [2.5, 97.5])
    print(f"{name:19s} RMSSE = {b.mean():.3f}   bias = {bias(f):+.1f} %   vendor vs this: {100 * (v.mean() / b.mean() - 1):+.1f} % [{100 * lo:+.1f}, {100 * hi:+.1f}]   vendor better on {np.mean(v < b):.0%} of items")

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

vendor              RMSSE = 0.797   bias = -4.2 %
last month (naive)  RMSSE = 0.964   bias = -5.4 %   vendor vs this: -17.4 % [-20.8, -13.9]   vendor better on 67% of items
12-month average    RMSSE = 0.745   bias = -4.7 %   vendor vs this: +7.0 % [+4.8, +9.3]   vendor better on 44% of items

The vendor beats the naive forecast by a wide margin, which is the comparison a sales deck would show. Against the twelve-month average it is slightly worse, with an interval that excludes zero: the product adds nothing to a formula in a spreadsheet. Both carry the same negative bias, because demand grew in the test window.

What a good answer looks like

A vendor who has done the work can state the test window, the settings frozen before it, the baselines, the interval on the gain and the cases where the method loses. Published work helps: a protocol deposited before the results, code that reruns, and results that include the hypotheses that failed. Petropoulos and co-authors survey the state of forecasting practice and insist on the same point, evaluation against benchmarks on data held out.

The same questions apply to an internal team and to a consultant, ourselves included.

In our work

This is the protocol of our own published study: settings frozen and deposited before the test windows were read, eight methods including a forecast of zero, several measures reported together, and the hypotheses that did not hold listed with the others.

References

  1. Petropoulos, F., Apiletti, D., Assimakopoulos, V., et al. (2022). Forecasting: theory and practice. International Journal of Forecasting, 38(3), 705-871. doi:10.1016/j.ijforecast.2021.11.001
  2. Tashman, L. J. (2000). Out-of-sample tests of forecasting accuracy: an analysis and review. International Journal of Forecasting, 16(4), 437-450. doi:10.1016/S0169-2070(00)00065-0
  3. Fildes, R., Goodwin, P., Lawrence, M., Nikolopoulos, K. (2009). Effective forecasting and judgmental adjustments: an empirical evaluation and strategic implications for supply-chain planning. International Journal of Forecasting, 25(1), 3-23. doi:10.1016/j.ijforecast.2008.11.010

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

  • The sealed test set, read onceA holdout sample gives an unbiased estimate once. Each time a decision is taken after looking at it, a little of it passes into the model. After enough rounds the reported score describes the holdout, not the future.
  • The zero forecast as a baselineA forecast of zero for every item and every period is useless for stock and has the best absolute error on most intermittent series. Including it in a comparison shows at once whether the error measure can be trusted.
  • Forecast bias: mean errorBias is the average of forecast minus actual. It says whether a method orders too much or too little over time, which no accuracy measure reports. A biased forecast can have the best accuracy score.
All library pages