DTW (Dynamic Time Warping) requires prior normalization?



I'm trying DTW from mlpy, to check similarity between time series.

Should I normalize the series before processing them with DTW? Or is it somewhat tolerant and I can use the series as they are?

All time series stored in a Pandas Dataframe, each in one column. Size is less than 10k points.


Posted 2017-01-02T19:45:40.040

Reputation: 273



DTW often uses a distance between symbols, e.g. a Manhattan distance $(d(x, y) = {\displaystyle |x-y|} $). Whether symbols are samples or features, they might require amplitude (or at least) normalization. Should they? I wish I could answer such a question in all cases. However, you can find some hints in:

Laurent Duval

Posted 2017-01-02T19:45:40.040

Reputation: 1 227


I am glad you asked ;-)

In 99% of cases, you must z-normalize.

Want to know why? I wrote a tutorial on this, page 46 http://www.cs.unm.edu/~mueen/DTW.pdf


Posted 2017-01-02T19:45:40.040

Reputation: 111

Any easy way to do this z-normalizaiton in Python? – KcFnMi – 2017-01-03T10:00:48.527

And, by the way, nice presentation! – KcFnMi – 2017-01-03T10:17:11.627

@KcFnMi z-normalization in Python: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.mstats.zscore.html

– Nikolas Rieble – 2017-01-05T08:56:46.230

@eamonn Awesome slides, thanks for sharing your experience, I can't up vote the answer enough – Emer – 2019-03-14T14:59:44.730

@eamonn What if the data is multimodal? – Alex – 2020-08-22T22:35:08.000