Back to models
Transformer

TruncationTransformer

MultivariateUnequal-length seriesEqualizes series length

Truncates unequal length panels between lower/upper length ranges.

Truncates each series in transform to iloc between integers lower (inclusive) and upper (exclusive).

If lower is None, it is set to 0.

If upper is None, it is set to the length of the shortest series in the panel passed to fit.

Quickstart

python
from sktime.transformations.truncation import TruncationTransformer

estimator = TruncationTransformer(lower=None, upper=None)

Tags

Capabilities

  • Multivariate
  • Unequal-length series
  • Equalizes series length: Supported
  • Inverse transform: Not supported
  • Missing values: Not supported
  • Removes missing values: 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)

lowerint, optional (default=None) minimum length, inclusive
If None, will find the length of the shortest series and use instead.
upperint, optional (default=None) maximum length, exclusive
Cannot be less than the length of the shortest series in the panel. This is used to calculate the range between. If None, will find the length of the shortest series and use instead.

Examples

Truncate only unequal length panels in data:
>>> from sktime.transformations.truncation import TruncationTransformer
>>> from sktime.utils._testing.hierarchical import _make_hierarchical
>>> X = _make_hierarchical(same_cutoff=False)
>>> tt = TruncationTransformer()
>>> tt.fit(X) TruncationTransformer(…)
>>> X_transformed = tt.transform(X) Truncate each panel to first 5 elements:
>>> from sktime.transformations.truncation import TruncationTransformer
>>> from sktime.utils._testing.hierarchical import _make_hierarchical
>>> X = _make_hierarchical(same_cutoff=False)
>>> tt = TruncationTransformer(upper=5)
>>> tt.fit(X) TruncationTransformer(…)
>>> X_transformed = tt.transform(X) Pick range from index 1 (inclusively) to 3 (exclusively):
>>> from sktime.transformations.truncation import TruncationTransformer
>>> from sktime.utils._testing.hierarchical import _make_hierarchical
>>> X = _make_hierarchical(same_cutoff=False)
>>> tt = TruncationTransformer(lower=1, upper=3)
>>> tt.fit(X) TruncationTransformer(…)
>>> X_transformed = tt.transform(X)