# How to measaure the similarity between two series?

I'm confused about how to measure the similarity between two time series with the same length. For example, both time series are 2 hours in length and every 5 minutes a point. I really want to know which Distance Algorithm should I use. I have tried the Euclidean Distance but it didn't work well on this type of data. Should I find some point-to-point distance algorithms?

• You can search the asked and now answered questions with the search bar up on this site. For example "distance time series" gives a variety of ideas, how to measure. Maybe this question on stackoverflow gives you more ideas how to define your distance. And if you are there now, you can find a lot of answered questions related, if you use the search too. I hope you find something that fits to your problem. If you have questions, that are not to find in this searches, you are welcome to ask again :) Apr 4, 2019 at 9:02
• It is not possible to answer your question, unless you show examples of the time series. To answer the question, we need to know the invarances needed, for example...warping, uniform scaling, offset, amplitude scaling, phase, occlusions, uncertainty and wandering baseline [a]. [a] cs.ucr.edu/~eamonn/… [b] cs.unm.edu/~mueen/DTW.pdf Apr 4, 2019 at 17:33

A classical approach for time series similarity computation is Dynamic Time Warping (DTW).

In general, DTW is a method that calculates an optimal match between two given sequences (e.g. time series) with certain restriction and rules:

• Every index from the first sequence must be matched with one or more indices from the other sequence, and vice versa
• The first index from the first sequence must be matched with the first index from the other sequence (but it does not have to be its only match)
• The last index from the first sequence must be matched with the last index from the other sequence (but it does not have to be its only match)
• The mapping of the indices from the first sequence to indices from the other sequence must be monotonically increasing, and vice versa, i.e. if $$j>i$$ are indices from the first sequence, then there must not be two indices $$l>k$$ in the other sequence, such that index $$i$$ is matched with index $$l$$ and index $$j$$ is matched with index $$k$$, and vice versa

Some alternatives to DTW can be found in this literature review on time series dissimilarity measures.

• Thanks for answering sincerely. But to be the best of my knowledge, DTW belongs to Elastic Measure. It's suitable for similarity measurement of sequence changes rather than morphology, e.g. it's often used in speech recognition. I only want to compare the vertical distance between two sequences without considering stretch or transformation of the sequences. It could be a point-to-point way of calculating or something. In addition, the time complexity of DTW is very high. Could you know some Lock-step Measures? Thank you. Apr 5, 2019 at 8:14
• In such a setting, a simple $L_1$ distance would be a good fit.
– noe
Apr 26, 2019 at 15:48
• Yeah, I think so too. And I have already implemented $L_1$ distance (and $L_2$ distance) but the results are not so good. Since I was calculating directly on the raw data (not exactly, $z-score$ implemented), I am now studying whether I can use some time series representations to make the results better. Can you help me? Thank you. May 6, 2019 at 7:46