Zurück zu den Modellen
Transformer

TruncationTransformer

MultivariateUnequal lengthUnequal length removes

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.

Schnellstart

python
from sktime.transformations.truncation import TruncationTransformer

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

Parameter(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.

Beispiele

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)