Back to models
Transformer (Pairwise Panel)

DtwDtaidistUniv

Univariate dynamic time warping distance, from dtaidistance.

Quickstart

python
from sktime.dists_kernels.dtw import DtwDtaidistUniv

estimator = DtwDtaidistUniv(use_c=False, window=None, max_dist=None, max_step=None, max_length_diff=None, penalty=None, psi=None, use_pruning=False)

Parameters(8)

use_c: bool, optional, default=False

Whether to use the faster C variant: True for C, False for Python. True requires a C compiled installation of dtaidistance.

  • If False, uses dtaidistance.dtw.distance_matrix.

  • If True, uses dtaidistance.dtw.distance_matrix_fast.

windowinteger, optional, default=infinite

Sakoe Chiba window width, from diagonal to boundary. Only allow for maximal shifts from the two diagonals smaller than this number. The maximally allowed warping, thus difference between indices i in series 1 and j in series 2, is thus |i-j| < 2*window + |len(s1) - len(s2)|. It includes the diagonal, meaning that Euclidean distance is obtained by setting window=1. If the two series are of equal length, this means that the band appearing on the cumulative cost matrix is of width 2*window-1. In other definitions of DTW this number may be referred to as the window instead.

max_dist: float, optional, default=infinite
Stop if the returned values will be larger than this value.
max_step: float, optional, default=infinite

Do not allow steps larger than this value. If the difference between two values in the two series is larger than this, thus if |s1[i]-s2[j]| > max_step, replace that value with infinity.

max_length_diff: int, optional, default=infinite
Return infinity if difference of length of two series is larger than this value.
penalty: float, optional, default=0
Penalty to add if compression or expansion is applied
psi: integer or 4-tuple of integers or none, optional, default=none
Psi relaxation parameter (ignore start and end of matching). If psi is a single integer, it is used for both start and end relaxations for both series in a pair of series. If psi is a 4-tuple, it is used as the psi-relaxation for (begin series1, end series1, begin series2, end series2). Useful for cyclical series.
use_pruning: bool, optional, default=False
Prune values based on Euclidean distance.

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.