Back to models
Transformer

Reconciler

Hierarchical reconciliation transformer.

Hierarchical reconciliation is a transformation which is used to make the predictions in a hierarchy of time-series sum together appropriately.

The methods implemented in this class only require the structure of the hierarchy or the forecasts values for reconciliation.

These functions are intended for transforming hierarchical forecasts, i.e. after prediction. However they are general and can be used to transform hierarchical time-series data.

For reconciliation methods that require historical values in addition to the forecasts, such as MinT, see the ReconcilerForecaster class.

For more versatile and efficient reconciliation in pipelines, see BottomUpReconciler, TopdownReconciler, OptimalReconciler, NonNegativeOptimalReconciler, MiddleOutReconciler, that apply reconciliation as preprocessing and postprocessing steps.

For further information on the methods, see [1].

Quickstart

python
from sktime.transformations.hierarchical.reconcile import Reconciler

estimator = Reconciler(method='bu')

Parameters(1)

method{“bu”, “ols”, “wls_str”, “td_fcst”}, default=”bu”

The reconciliation approach applied to the forecasts

  • "bu" - bottom-up

  • "ols" - ordinary least squares

  • "wls_str" - weighted least squares (structural)

  • "td_fcst" - top down based on (forecast) proportions

Examples

>>> from sktime.forecasting.trend import PolynomialTrendForecaster
>>> from sktime.transformations.hierarchical.reconcile import Reconciler
>>> from sktime.transformations.hierarchical.aggregate import Aggregator
>>> from sktime.utils._testing.hierarchical import _bottom_hier_datagen
>>> agg = Aggregator ()
>>> y = _bottom_hier_datagen (
... no_bottom_nodes = 3,
... no_levels = 1,
... random_seed = 123,
... )
>>> y = agg. fit_transform (y)
>>> forecaster = PolynomialTrendForecaster ()
>>> forecaster. fit (y) PolynomialTrendForecaster(
... )
>>> prds = forecaster. predict (fh = [1 ])
>>> # reconcile forecasts
>>> reconciler = Reconciler (method = "ols")
>>> prds_recon = reconciler. fit_transform (prds)

References