Back to models
Metric

OverallWeightedAverage

Overall Weighted Average (OWA) metric as used in the M4 competition.

Quickstart

python
from sktime.performance_metrics.forecasting import OverallWeightedAverage

estimator = OverallWeightedAverage(sp=1, multioutput='uniform_average', multilevel='uniform_average', by_index=False, eps=None)

Parameters(5)

spint, default=1
Seasonal periodicity of the data.
epsfloat, default=None
Numerical epsilon used in denominator to avoid division by zero. Absolute values smaller than eps are replaced by eps. If None, defaults to np.finfo(np.float64).eps
multioutput‘uniform_average’ (default), 1D array-like, or ‘raw_values’

Whether and how to aggregate metric for multivariate (multioutput) data.

  • If 'uniform_average' (default), errors of all outputs are averaged with uniform weight.

  • If 1D array-like, errors are averaged across variables, with values used as averaging weights (same order).

  • If 'raw_values', does not average across variables (outputs), per-variable errors are returned.

multilevel{‘raw_values’, ‘uniform_average’, ‘uniform_average_time’}

How to aggregate the metric for hierarchical data (with levels).

  • If 'uniform_average' (default), errors are mean-averaged across levels.

  • If 'uniform_average_time', metric is applied to all data, ignoring level index.

  • If 'raw_values', does not average errors across levels, hierarchy is retained.

by_indexbool, default=False

Controls averaging over time points in direct call to metric object.

  • If False (default), direct call to the metric object averages over time points, equivalent to a call of the evaluate method.

  • If True, direct call to the metric object evaluates the metric at each time point, equivalent to a call of the evaluate_by_index method.

Examples

>>> from sktime.performance_metrics.forecasting import OverallWeightedAverage
>>> import numpy as np
>>> y_true = np. array ([100, 110, 105, 120 ])
>>> y_pred = np. array ([102, 108, 107, 118 ])
>>> y_train = np. array ([90, 95, 100, 110, 105, 100 ])
>>> metric = OverallWeightedAverage (sp = 1)
>>> metric (y_true, y_pred, y_train = y_train) np.float64(0.14512226890252225)

References

  1. Makridakis, S., Spiliotis, E., & Assimakopoulos, V. (2020). The M4 Competition: 100,000 time series and 61 forecasting methods. International Journal of Forecasting, 36(1), 54-74. https://doi.org/10.1016/j.ijforecast.2019.04.014