TransformByLevel
Transform by instance or panel.
Used to apply multiple copies of transformer by instance or by panel.
If groupby="global", behaves like transformer. If groupby="local", fits a clone of transformer per time series instance. If groupby="panel", fits a clone of transformer by panel (first non-time level).
The fitted transformers can be accessed in the transformers_ attribute, if more than one clone is fitted, otherwise in the transformer_ attribute.
Quickstart
from sktime.transformations.compose import TransformByLevel
estimator = TransformByLevel(transformer, groupby='local', raise_warnings=True)Tags
Capabilities
- Multivariate
- Missing values
- Unequal-length series
- Inverse transform: 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(3)
- transformersktime transformer used in TransformByLevel
A “blueprint” transformer, state does not change when
fitis called.- groupbystr, one of [“local”, “global”, “panel”], optional, default=”local”
level on which data are grouped to fit clones of
transformer“local” = unit/instance level, one reduced model per lowest hierarchy level “global” = top level, one reduced model overall, on pooled data ignoring levels “panel” = second lowest level, one reduced model per panel level (-2) if there are 2 or less levels, “global” and “panel” result in the same if there is only 1 level (single time series), all three settings agree- raise_warningsbool, optional, default=True
whether to warn the user if
transformeris instance-wise in this case wrapping thetransformeromTransformByLeveldoes not change the estimator logic, compared to not wrapping it. Wrapping this way can make sense in some cases of tuning, in which casewarn=Falsecan be set to suppress the warning raised.
Examples
>>> from sktime.transformations.compose import TransformByLevel
>>> from sktime.transformations.hierarchical.reconcile import Reconciler
>>> from sktime.utils._testing.hierarchical import _make_hierarchical
>>> X = _make_hierarchical ()
>>> f = TransformByLevel (Reconciler (), groupby = "panel")
>>> f. fit (X) TransformByLevel(
... )