Timing-aware metric for intermittent demand forecasting
Project description
pip install intermittent_alignment_error
Intermittent Alignment Error
Timing-aware evaluation for intermittent demand forecasts
This repository contains the reference implementation of Intermittent Alignment Error (IAE), a metric for evaluating intermittent demand forecasts when both timing and magnitude matter.
IAE is most useful when forecasts are expressed in the same unit as the original time-series, with zero-demand periods and non-zero demand events across a forecasting horizon. It is designed for point forecasts and is especially useful when comparing models across heterogeneous intermittent time-series.
For a quick start, see the example.ipynb notebook in this repository.
Examples
The examples below illustrate how the metric behaves under different types of forecasting errors.
Early and late forecasts
|
|
|
|
Forecast shifted early. The forecast is close in time to the ground truth and arrives before demand occurs, which tends to keep the in-time error low. |
Forecast shifted late. The forecast may still be close in time to the ground truth, but demand is not covered before it occurs, which increases the in-time error. |
Metric components
|
|
|
|
Recall and precision error. Recall error measures how well actual demand events are captured by the forecast. Precision error measures how well forecasted demand is supported by actual demand. |
Mass and in-time error. Mass error measures whether the total demand over the horizon is correct. In-time error measures whether enough demand has been forecasted before actual demand occurs. |
Standard timing-aware setting
This figure shows how the metric behaves under different combinations of timing and magnitude errors for three different ADI scenarios. Each matrix visualises the average metric score when forecasts are shifted earlier or later in time and scaled up or down in demand size, illustrating how the standard IAE setting responds to different types of forecasting errors across varying levels of intermittency.
Demand rate setting
Some forecasting methods, such as Croston-style demand rate forecasts, are not intended to predict exact event timing. In that case, the metric can be configured to focus only on mass and in-time.
Demand rate forecast example
Demand rate metric matrix
To use the demand rate setting, turn off recall and precision by setting their weights to zero:
metric_params = {
"recall_weight": 0.0,
"precision_weight": 0.0,
"mass_weight": 1.0,
"in_time_weight": 1.0,
"p": 2.0,
"in_time_relevance_mode": "linear",
}
This configuration is appropriate when the forecast is intended to represent a rate or cumulative coverage over the horizon rather than exact local alignment of demand events.
The version of the metric used in the licentiate thesis Decision Support through Global Demand Forecasting is preserved in the licentiate_thesis branch. The main branch contains the current version of the implementation.
License
This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
Please cite the corresponding paper when using this metric in academic work.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intermittent_alignment_error-0.1.2.tar.gz.
File metadata
- Download URL: intermittent_alignment_error-0.1.2.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb0b48121beab664bbd7765c0b9eebc06666be419fbe2763aff6719a4c53cfa6
|
|
| MD5 |
02e5011c4549571857602ac2b0be7913
|
|
| BLAKE2b-256 |
dee5ba2b96753e6bcfd668692fc8cd5c8c4c3477c39bc20f05b0fd40c9fa9dea
|
File details
Details for the file intermittent_alignment_error-0.1.2-py3-none-any.whl.
File metadata
- Download URL: intermittent_alignment_error-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40f651f3afaad57897cbafdbdf1a6fb425853103a4c0961c01be71ba1575b6cd
|
|
| MD5 |
cc510c968559f4a172dd4fbd16dba11c
|
|
| BLAKE2b-256 |
f107a20b8c2091b23f91daa46bdab76cc7dc15707ae9d852c80feb2d85c16a8a
|