Back to models
Transformer

Aggregator

Prepare hierarchical data, including aggregate levels, from bottom level.

This transformer adds aggregate levels via summation to a DataFrame with a multiindex. The aggregate levels are included with the special tag “__total” in the index. The aggregate nodes are discovered from top-to-bottom from the input data multiindex.

Quickstart

python
from sktime.transformations.hierarchical.aggregate import Aggregator

estimator = Aggregator(flatten_single_levels=True, bypass_inverse_transform=True)

Tags

Capabilities

  • Multivariate
  • Inverse transform: Supported
  • Unequal-length series
  • 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
Yes
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)

flatten_single_levelboolean (default=True)
Remove aggregate nodes, i.e. (“__total”), where there is only a single child to the level
bypass_inverse_transformboolean (default=True)
If True, the inverse_transform method is skipped. If False, the inverse_transform method is implemented and can be used to remove aggregate levels from the data.

Examples

>>> 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)

References