mvtsa.warping.dtw#

mvtsa.warping.dtw(x, y, window=None, metric='sqeuclidean', step='symmetric1', penalty=0.0, normalize=False)[source]#

DTW distance of two (multivariate) series.

Parameters:
x, yarrays (T_x, n), (T_y, n)
windowsee window_mask()
metriclocal cost (see local_cost_matrix()), or "precomputed"

if x is already the cost matrix.

step{“symmetric1”, “symmetric2”, “asymmetric”}

Local constraint ("symmetric1" is type I of Rabiner and Juang).

penaltyfloat

Additive cost of every non-diagonal step.

normalizebool

Divide by T_x + T_y (symmetric2) or by the path length.

Examples

>>> x = np.array([0., 0, 1, 2, 1, 0]); y = np.array([0., 1, 2, 1, 0, 0])
>>> float(dtw(x, y))
0.0

Examples using mvtsa.warping.dtw#

Dynamic time warping and global constraints

Dynamic time warping and global constraints