Transformer
SlidingWindowSegmenter
Sliding window segmenter transformer.
This class is to transform a univariate series into a multivariate one by extracting sets of subsequences. It does this by firstly padding the time series on either end floor(window_length/2) times. Then it performs a sliding window of size window_length and hop size 1.
e.g. if window_length = 3
S = 1,2,3,4,5, floor(3/2) = 1 so S would be padded as
1,1,2,3,4,5,5
then SlidingWindowSegmenter would extract the following:
(1,1,2),(1,2,3),(2,3,4),(3,4,5),(4,5,5)
the time series is now a multivariate one.
Schnellstart
python
from sktime.transformations.segment import SlidingWindowSegmenter
estimator = SlidingWindowSegmenter(window_length=5)Tags
Fähigkeiten
- Reihen ungleicher Länge
- Multivariat: Nicht unterstützt
- Inverse Transformation: Nicht unterstützt
- Fehlende Werte: Nicht unterstützt
- Entfernt fehlende Werte: Nicht unterstützt
- Gleicht Reihenlängen an: Nicht unterstützt
Eigenschaften
- Eingabetypscitype:transform-input
- Series
- Ausgabetypscitype:transform-output
- Series
- Label-Typscitype:transform-labels
- None
- Fit ist leerfit_is_empty
- Ja
- Behält den Zeitindextransform-returns-same-time-index
- Nein
- Benötigt Xrequires_X
- Ja
- Benötigt yrequires_y
- Nein
- X und y brauchen denselben IndexX-y-must-have-same-index
- Nein
Parameter(2)
- window_lengthint, optional, default=5.
- length of sliding window interval
- Used by the ShapeDTW algorithm.
Beispiele
>>> import pandas as pd
>>> from sktime.transformations.segment import SlidingWindowSegmenter
>>> X = pd. DataFrame ({ "a": [1, 2, 3, 4, 5 ]})
>>> t = SlidingWindowSegmenter (window_length = 3)
>>> t. fit_transform (X) 0 1 2 3 4 0 1 1 2 3 4 1 1 2 3 4 5 2 2 3 4 5 5 The output always has window_length rows and as many columns as there are original time points, regardless of the window size:
>>> t2 = SlidingWindowSegmenter (window_length = 2)
>>> t2. fit_transform (X) 0 1 2 3 4 0 1 1 2 3 4 1 1 2 3 4 5