Aligner
AlignerDTW
Aligner interface for dtw-python.
- Behaviour: computes the full alignment between X[0] and X[1]
assumes pairwise alignment (only two series) and univariate if multivariate series are passed: alignment is computed on univariate series with variable_to_align; if this is not set, defaults to the first variable of X[0] raises an error if variable_to_align is not present in X[0] or X[1]
Schnellstart
python
from sktime.alignment.dtw_python import AlignerDTW
estimator = AlignerDTW(dist_method='euclidean', step_pattern='symmetric2', window_type='none', window_size=None, open_begin=False, open_end=False, variable_to_align=None)Parameter(7)
- dist_methodstr, optional, default = “euclidean”
distance function to use, a distance on real n-space one of the functions in
scipy.spatial.distance.cdist- step_patternstr, optional, or dtw_python stepPattern object, optional
- step pattern to use in time warping one of: ‘symmetric1’, ‘symmetric2’ (default), ‘asymmetric’, and dozens of other more non-standard step patterns; list can be displayed by calling help(stepPattern) in dtw
- window_typestring, the chosen windowing function
“none”, “itakura”, “sakoechiba”, or “slantedband”
“none” (default) - no windowing
“sakoechiba” - a band around main diagonal
“slantedband” - a band around slanted diagonal
“itakura” - Itakura parallelogram
- window_size: int, optional, default=None
- size of the window if a windowing function is used if None and window_type=”sakoechiba”, defaults to 10% of series length
- open_beginboolean, optional, default=False
- open_end: boolean, optional, default=False
- whether to perform open-ended alignments open_begin = whether alignment open ended at start (low index) open_end = whether alignment open ended at end (high index)
- variable_to_alignstring, default = first variable in X[0] as passed to fit
- which variable to use for univariate alignment
Beispiele
Basic usage example:
>>> import numpy as np
>>> import pandas as pd
>>> from sktime.alignment.dtw_python import AlignerDTW
>>> X = [
... pd. DataFrame ({ 'col1': np. random. randn (100)}),
... pd. DataFrame ({ 'col1': np. random. randn (100)})
... ]
>>> aligner = AlignerDTW (dist_method = 'euclidean', step_pattern = 'symmetric2')
>>> aligner. fit (X) AlignerDTW(
... )
>>> alignment_df = aligner. get_alignment () Advanced usage example with open-ended alignment:
>>> aligner_advanced = AlignerDTW (
... dist_method = 'cityblock',
... window_type = 'sakoechiba',
... window_size = 10,
... step_pattern = 'asymmetric',
... open_begin = True,
... open_end = True,
... )
>>> X_advanced = [
... pd. DataFrame ({ 'col1': np. random. randn (150)}),
... pd. DataFrame ({ 'col1': np. random. randn (150)})
... ]
>>> aligner_advanced. fit (X_advanced) AlignerDTW(
... )
>>> alignment_df_advanced = aligner_advanced. get_alignment ()