Skip to content

HorizonMetric

Measures performance at each time step ahead.

This allows to measure the performance of a model at each time step along the horizon. A copy of the provided regression metric is made for each time step.

Parameters

  • metric ('metrics.base.RegressionMetric')

    A regression metric.

Examples

This is used internally by the time_series.evaluate function.

>>> from river import datasets
>>> from river import metrics
>>> from river import time_series

>>> metric = time_series.evaluate(
...     dataset=datasets.AirlinePassengers(),
...     model=time_series.HoltWinters(alpha=0.1),
...     metric=metrics.MAE(),
...     horizon=4
... )

>>> metric
+1 MAE: 40.931286
+2 MAE: 42.667998
+3 MAE: 44.158092
+4 MAE: 43.849617

Methods

get

Return the current performance along the horizon.

Returns

typing.List[float]: The current performance.

update

Update the metric at each step along the horizon.

Parameters

  • y_true ('typing.List[Number]')
  • y_pred ('typing.List[Number]')

Returns

'ForecastingMetric': self