Back to models
Aligner

AlignerDtwNumba

DistanceDistance-matrix

Interface to sktime native dtw aligners, with derivative or weighting.

Quickstart

python
from sktime.alignment.dtw_numba import AlignerDtwNumba

estimator = AlignerDtwNumba(weighted: bool=False, derivative: bool=False, window=None, itakura_max_slope=None, bounding_matrix: ndarray=None, g: float=0.0)

Parameters(6)

weightedbool, optional, default=False
whether a weighted version of the distance is computed False = unmodified distance, i.e., dtw distance or derivative dtw distance True = weighted distance, i.e., weighted dtw or derivative weighted dtw
derivativebool, optional, default=False
whether the distance or the derivative distance is computed False = unmodified distance, i.e., dtw distance or weighted dtw distance True = derivative distance, i.e., derivative dtw distance or derivative wdtw
window: int, defaults = None

Sakoe-Chiba window radius one of three mutually exclusive ways to specify bounding matrix if None, does not use Sakoe-Chiba window if int, uses Sakoe-Chiba lower bounding window with radius window. If window is passed, itakura_max_slope will be ignored.

itakura_max_slope: float, between 0. and 1., default = None

Itakura parallelogram slope one of three mutually exclusive ways to specify bounding matrix if None, does not use Itakura parallelogram lower bounding if float, uses Itakura parallelogram lower bounding, with slope gradient itakura_max_slope

bounding_matrix: optional, 2D np.ndarray, default=None

one of three mutually exclusive ways to specify bounding matrix must be of shape (len(X), len(X2)), len meaning number time points, where X, X2 are the two time series passed in transform Custom bounding matrix to use. If provided, then window and itakura_max_slope are ignored. The matrix should be structured so that indexes considered in bound should be the value 0. and indexes outside the bounding matrix should be infinity.

g: float, optional, default = 0. Used only if ``weighted=True``.

Constant that controls the curvature (slope) of the function; that is, g controls the level of penalisation for the points with larger phase difference.

Examples

>>> from sktime.utils._testing.series import _make_series
>>> from sktime.alignment.dtw_numba import AlignerDtwNumba
>>> 
>>> X0 = _make_series (return_mtype = "pd.DataFrame")
>>> X1 = _make_series (return_mtype = "pd.DataFrame")
>>> d = AlignerDtwNumba (weighted = True, derivative = True)
>>> align = d. fit ([X0, X1 ]). get_alignment ()

References

  1. [1 ] H. Sakoe, S. Chiba, “Dynamic programming algorithm optimization for spoken word recognition,” IEEE Transactions on Acoustics, Speech and Signal Processing, vol. 26(1), pp. 43–49, 1978. [2 ] Keogh, Eamonn & Pazzani, Michael. (2002). Derivative Dynamic Time Warping. First SIAM International Conference on Data Mining. 1. 10.1137/1.9781611972719.1. [3 ] (1, 2) Young-Seon Jeong, Myong K. Jeong, Olufemi A. Omitaomu, Weighted dynamic time warping for time series classification, Pattern Recognition, Volume 44, Issue 9, 2011, Pages 2231-2240, ISSN 0031-3203, https://doi.org/10.1016/j.patcog.2010.09.022.