Back to models
Transformer

MiddleOutReconciler

Inverse transformUnequal-length series

Reconciliation using a middle-out approach.

This reconciliation strategy splits the hierarchy at a given level and applies a bottom-up strategy to the top part of the hierarchy and a topdown strategy to the bottom part of the hierarchy.

The parameter middle-level is determined by the level according to the hierarchy tree. For example, consider the following structure with four levels:

``` __total ├── B1 │ ├── C1 │ │ ├── D1 │ │ └── D2 │ └── C2 │ ├── D3 │ └── D4 └── B2

├── C3 │ ├── D5 │ └── D6

```

If middle_level is set to 0, then the hierarchy is split at the root node. If middle_level is set to 1, then the hierarchy is split at the first level below the root node, in this example, the nodes [B1, B2].

It is important to note that the height of this hierarchy tree don’t necessarily coincides with the number of levels in the pd.DataFrame index. For example, the following index has 3 levels, but the tree has 4 levels:

` __total, __total, __total B1, __total, __total B1, C1, __total ... B2, __total, __total B2, C3, __total ... `

Quickstart

python
from sktime.transformations.hierarchical.reconcile import MiddleOutReconciler

estimator = MiddleOutReconciler(middle_level: int, middle_bottom_reconciler: BaseTransformer=None)

Tags

Capabilities

  • Inverse transform: Supported
  • Unequal-length series
  • Multivariate: Not supported
  • Missing values: Not supported
  • Removes missing values: Not supported
  • Equalizes series length: Not supported

Properties

Input typescitype:transform-input
Series
Output typescitype:transform-output
Series
Label typescitype:transform-labels
None
Fit is emptyfit_is_empty
No
Keeps the time indextransform-returns-same-time-index
No
Requires Xrequires_X
Yes
Requires yrequires_y
No
X and y need the same indexX-y-must-have-same-index
No

Parameters(2)

middle_levelint
The level at which to split the hierarchy for reconciliation.
middle_bottom_reconcilerBaseTransformer
The transformer to use for each subtree below the middle-level totals.

Examples

>>> from sktime.transformations.hierarchical.reconcile import (
... MiddleOutReconciler)
>>> from sktime.utils._testing.hierarchical import _make_hierarchical
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.transformations.hierarchical.aggregate import Aggregator
>>> y = _make_hierarchical (hierarchy_levels = (2, 2, 4))
>>> pipe = MiddleOutReconciler (middle_level = 1) * NaiveForecaster ()
>>> pipe = pipe. fit (y)
>>> y_pred = pipe. predict (fh = [1, 2, 3 ])