Quantcast
Viewing latest article 1
Browse Latest Browse All 3

Answer by Felipe Mello for Efficient pairwise DTW calculation using numpy or cython

To be honest, fastdtw is not fast at all

from cdtw import pydtwfrom dtaidistance import dtwfrom fastdtw import fastdtwfrom scipy.spatial.distance import euclideans1=np.array([1,2,3,4],dtype=np.double)s2=np.array([4,3,2,1],dtype=np.double)%timeit dtw.distance_fast(s1, s2)4.1 µs ± 28.6 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)%timeit d2 = pydtw.dtw(s1,s2,pydtw.Settings(step = 'p0sym', window = 'palival', param = 2.0, norm = False, compute_path = True)).get_dist()45.6 µs ± 3.39 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)%timeit d3,_=fastdtw(s1, s2, dist=euclidean)901 µs ± 9.95 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

fastdtw is 219 times slower than dtaidistance lib and 20x slower than cdtw

Consider changing. Here is dtaidistance git:

https://github.com/wannesm/dtaidistance

To install, just:

pip install dtaidistance

Viewing latest article 1
Browse Latest Browse All 3

Trending Articles