Features:
Input
- derivative - [bool] Derivative DTW (DDTW).
- startbc - [bool] (0, 0) boundary condition
- steppattern - [string] step pattern (‘symmetric’, ‘asymmetric’, ‘quasisymmetric’)
- wincond - [string] window condition (‘nowindow’, ‘sakoechiba’)
- r - [float] sakoe-chiba window length
- onlydist - [bool] linear space-complexity implementation. Only the current and previous columns are kept in memory.
New in version 2.0.7.
Input
- x - [1D numpy array float / list] first time series
- y - [1D numpy array float / list] second time series
Output
- d - [float] normalized distance
- self.px - [1D numpy array int] optimal warping path (for x time series) (for onlydist=False)
- self.py - [1D numpy array int] optimal warping path (for y time series) (for onlydist=False)
- self.cost - [2D numpy array float] cost matrix (for onlydist=False)
Example:
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import mlpy
>>> x = np.array([1,1,2,2,3,3,4,4,4,4,3,3,2,2,1,1])
>>> y = np.array([1,1,1,1,1,1,1,1,1,1,2,2,3,3,4,3,2,2,1,2,3,4])
>>> plt.figure(1)
>>> plt.subplot(211)
>>> plt.plot(x)
>>> plt.subplot(212)
>>> plt.plot(y)
>>> plt.show()
>>> mydtw = mlpy.Dtw()
>>> d = mydtw.compute(x, y)
>>> plt.figure(2)
>>> plt.imshow(mydtw.cost.T, interpolation='nearest', origin='lower')
>>> plt.plot(mydtw.px, mydtw.py, 'r')
>>> plt.show()
Computes the Minkowski distance between two vectors x and y.
{||x-y||}_p = (\sum{|x_i - y_i|^p})^{1/p}.
Initialize Minkowski class.
Parameters: |
|
---|
New in version 2.0.8.
Compute Minkowski distance
Parameters: |
|
---|---|
Returns: |
|
[Senin08] | Pavel Senin. Dynamic Time Warping Algorithm Review |
[Keogh01] | Eamonn J. Keogh and Michael J. Pazzani. Derivative Dynamic Time Warping. First SIAM International Conference on Data Mining (SDM 2001), 2001. |
[Sakoe78] | (1, 2) Hiroaki Sakoe and Seibi Chiba. Dynamic Programming Algorithm Optimization for Spoken Word Recognition. IEEE Transactions on Acoustics, Speech, and Signal Processing. Volume 26, 1978. |