 Dynamic time warping (DTW) is an algorithm for measuring similarity between two temporal sequences, which may vary in speed.In general, DTW is a method that calculates an optimal match between two given sequences (e.g.time series) with certain restriction and rules.