Parameterizing the cost function of dynamic time warping with application to time series classification

Matthieu Herrmann, Chang Wei Tan, Geoffrey I. Webb

Research output: Contribution to journalArticleResearchpeer-review

2 Citations (Scopus)


Dynamic time warping (DTW) is a popular time series distance measure that aligns the points in two series with one another. These alignments support warping of the time dimension to allow for processes that unfold at differing rates. The distance is the minimum sum of costs of the resulting alignments over any allowable warping of the time dimension. The cost of an alignment of two points is a function of the difference in the values of those points. The original cost function was the absolute value of this difference. Other cost functions have been proposed. A popular alternative is the square of the difference. However, to our knowledge, this is the first investigation of both the relative impacts of using different cost functions and the potential to tune cost functions to different time series classification tasks. We do so in this paper by using a tunable cost function λγ with parameter γ. We show that higher values of γ place greater weight on larger pairwise differences, while lower values place greater weight on smaller pairwise differences. We demonstrate that training γ significantly improves the accuracy of both the DTW nearest neighbor and Proximity Forest classifiers.

Original languageEnglish
Pages (from-to)2024–2045
Number of pages22
JournalData Mining and Knowledge Discovery
Publication statusPublished - 16 Apr 2023


  • Classification
  • Dynamic time warping
  • Elastic distances
  • Time series

Cite this