Back to models
Transformer

TruncationTransformer

MultivariateUnequal lengthUnequal length removes

Truncates unequal length panels between lower/upper length ranges.

Quickstart

python
from sktime.transformations.truncation import TruncationTransformer

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

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)