1

In time series analysis, dynamic time warping (DTW) is one of the algorithms for measuring similarity between two temporal sequences, which may vary in speed. Fast DTW is a more faster method. I would like to know how to implement this method not only between 2 signals but 3 or more.

distance, warp_path = fastdtw(series2, series1, dist=euclidean)
Fresco
  • 253
  • 1
  • 5
  • 16
Ersi Ago
  • 15
  • 1
  • 6

1 Answers1

2

You essentially need to construct a matrix, evaluating the FastDTW algorithm on all possible combinations of the series.

import fastdtw
import scipy.spatial.distance as sd

def my_fastdtw(sales1, sales2):
    return fastdtw.fastdtw(sales1,sales2)[0]

distance_matrix = sd.pdist(sales, my_fastdtw)

You can see this thread for a reference on how to do it, as well as other possibilities: Efficient pairwise DTW calculation using numpy or cython

Julian
  • 86
  • 1
  • 2