wannesm / dtaidistance

Time series distances: Dynamic Time Warping (fast DTW implementation in C)
Other
1.08k stars 184 forks source link

Maybe incorrect to calculate the dtaidistance.dtw_ndim.distance #202

Closed Goddarkness closed 9 months ago

Goddarkness commented 10 months ago

It looks like that you calculate the dtaidistance.dtw_ndim.distance by sum the (s1(i)-s2(j))^2, then do the sqrt(). But from the information I searched from the Internet, it sum the distance of each point, as it do the sqrt() first then sum them up. as sum(sqrt((s1(i)-s2(j))^2))

wannesm commented 10 months ago

You are describing the difference between squared Euclidean and Euclidean. Both are used in papers, and dtaidistance defaults to squared Euclidean (see also the docs). The master branch supports both, though.

tiennvhust commented 9 months ago

This explained my issue! Thank you :)