Suppose that we need to compare 2 time series (quite look-alike),
An example of 2 time series to be compared using DTW. Source of the idea.
They're quite look-alike but if we compare point-to-point, they're clearly very different!
With DTW, we compare:
Dynamic Time Warping is used to compare the similarity or calculate the distance between two arrays or time series with different length.
Difference between DTW and Euclidian distance. Source.
By using a distance matrix, we can find a good distance between 2 timeseries using DTW. Here, $8=3^2-1^2$ and we choose the smallest distance in the nearest position. Source.
More detailed of calculating the distance matrix using DTW. Ai
: element i
th of A
; D[i-1, j-1]
: The DTW between element i-1
th and j-1
th. Source.
👉 Check this video fore a more explanation.