Calculate the similarity between pairs of time series data

I have 5 pieces of time series data. It is the weekly sales of 5 different stores (A,B,C,D,E). There are no missing values. A quick visual inspection shows that these 5 pieces of time series data have similar trend seasonality.

I would like to calculate/quantify how similar Store B,C,D,E is to Store A respectively.

I know how to calculate the simple cosine distance and Euclidean distance, and I have experience dealing with time series data (e.g. ARIMA, Prophet), but never had to deal with finding (i.e. quantifying) the similarity / distance between time series data.

Some google search suggests that dynamic time warping could be the method to go. I have not yet heard of this algorithm before, so not sure if this is indeed the right direction.

Additionally, can I still perform cosine distance and Euclidean distance on time series data? Is that doable?

How do I approach this issue? Any insights are appreciated.

Topic dynamic-time-warping cosine-distance time-series similarity

Category Data Science


Euclidean distance metric is unsuitable for time series...In short, it is invariant to time shifts, ignoring the time dimension of the data. If two time series are highly correlated, but one is shifted by even one time step, Euclidean distance would erroneously measure them as further apart. You might use it to compare your time series if you are extracting their features. Don't need to go and use directly PCA. You can use simple descriptive stats such as mean, min, max, kurtosis, etc...Then you can compare it with Euclidean.

I advise you to give it a try with DTW. ;)

How does it work?

http://alexminnaar.com/2014/04/16/Time-Series-Classification-and-Clustering-with-Python.html (you can check that blog post, it explains it nicely)

Good luck to you!

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.