Skip to main content
QUICK REVIEW

[Paper Review] Dynamic Time Warping in Strongly Subquadratic Time: Algorithms for the Low-Distance Regime and Approximate Evaluation

William Kuszmaul|arXiv (Cornell University)|Jan 1, 2019
Time Series Analysis and ForecastingComputer Science42 references1 citations
TL;DR

This paper presents the first strongly subquadratic algorithm for Dynamic Time Warping (DTW) in the low-distance regime, computing DTW in O(n · dtw(x, y)) time for strings over any metric space with minimum non-zero distance 1. It further introduces an O(n²⁻ᵝ)-time approximation algorithm with O(nᵝ) approximation factor for DTW over tree metrics, and establishes new conditional lower bounds for DTW and LCS via reductions from edit distance.

ABSTRACT

Dynamic time warping distance (DTW) is a widely used distance measure between time series, with applications in areas such as speech recognition and bioinformatics. The best known algorithms for computing DTW run in near quadratic time, and conditional lower bounds prohibit the existence of significantly faster algorithms. The lower bounds do not prevent a faster algorithm for the important special case in which the DTW is small, however. For an arbitrary metric space Sigma with distances normalized so that the smallest non-zero distance is one, we present an algorithm which computes dtw(x, y) for two strings x and y over Sigma in time O(n * dtw(x, y)). When dtw(x, y) is small, this represents a significant speedup over the standard quadratic-time algorithm. Using our low-distance regime algorithm as a building block, we also present an approximation algorithm which computes dtw(x, y) within a factor of O(n^epsilon) in time O~(n^{2 - epsilon}) for 0 < epsilon < 1. The algorithm allows for the strings x and y to be taken over an arbitrary well-separated tree metric with logarithmic depth and at most exponential aspect ratio. Notably, any polynomial-size metric space can be efficiently embedded into such a tree metric with logarithmic expected distortion. Extending our techniques further, we also obtain the first approximation algorithm for edit distance to work with characters taken from an arbitrary metric space, providing an n^epsilon-approximation in time O~(n^{2 - epsilon}), with high probability. Finally, we turn our attention to the relationship between edit distance and dynamic time warping distance. We prove a reduction from computing edit distance over an arbitrary metric space to computing DTW over the same metric space, except with an added null character (whose distance to a letter l is defined to be the edit-distance insertion cost of l). Applying our reduction to a conditional lower bound of Bringmann and Künnemann pertaining to edit distance over {0, 1}, we obtain a conditional lower bound for computing DTW over a three letter alphabet (with distances of zero and one). This improves on a previous result of Abboud, Backurs, and Williams, who gave a conditional lower bound for DTW over an alphabet of size five. With a similar approach, we also prove a reduction from computing edit distance (over generalized Hamming Space) to computing longest-common-subsequence length (LCS) over an alphabet with an added null character. Surprisingly, this means that one can recover conditional lower bounds for LCS directly from those for edit distance, which was not previously thought to be the case.

Motivation & Objective

  • To develop a faster algorithm for DTW when the true distance is small, overcoming the near-quadratic lower bound in general cases.
  • To design an approximation algorithm for DTW that runs in strongly subquadratic time with provable approximation guarantees.
  • To extend techniques to approximate edit distance over arbitrary metric spaces and derive new conditional lower bounds for DTW and LCS.
  • To establish reductions from edit distance and LCS to DTW with a null character, enabling transfer of conditional lower bounds.

Proposed method

  • Design a novel asymmetric dynamic programming formulation treating one string as letters and the other as runs of equal characters, limiting subproblems to O(nK) for distance threshold K.
  • Use recursive subproblem decomposition with role toggling between strings to bound the number of low-cost subproblems.
  • Apply random scaling (r ∈ [R, 2R]) to reduce edit distance in randomized samples, enabling probabilistic guarantees via Markov's inequality.
  • Construct a gap-based algorithm for edit distance using randomized sampling and binary search over scale parameters to distinguish small vs. large distances.
  • Embed arbitrary metric spaces into well-separated tree metrics with logarithmic depth and low expected distortion to enable efficient approximation.
  • Reduce edit distance over metric spaces to DTW with a null character (distance = insertion cost), transferring conditional lower bounds from edit distance to DTW.

Experimental results

Research questions

  • RQ1Can DTW be computed faster than O(n²) when the true distance is small?
  • RQ2Is there a strongly subquadratic approximation algorithm for DTW over general metric spaces?
  • RQ3Can conditional lower bounds for edit distance be transferred to DTW via reductions?
  • RQ4Can the same reduction technique be used to derive lower bounds for LCS from edit distance?
  • RQ5What is the impact of random scaling on edit distance in sampled strings?

Key findings

  • The paper presents an O(n · dtw(x, y))-time algorithm for DTW in the low-distance regime, significantly improving over O(n²) for small dtw values.
  • An O(n²⁻ᵝ)-time O(nᵝ)-approximation algorithm is developed for DTW over tree metrics with logarithmic depth and at most exponential aspect ratio.
  • Any polynomial-size metric space can be embedded into such a tree metric with logarithmic expected distortion, enabling the approximation algorithm to be applied generally.
  • The paper proves a conditional lower bound for DTW over a three-letter alphabet using a reduction from edit distance over {0,1}, improving upon prior bounds for larger alphabets.
  • A reduction from edit distance over generalized Hamming space to LCS with a null character allows transfer of conditional lower bounds from edit distance to LCS.
  • The expected edit distance between randomized samples sr(x) and sr(y) is at most 5 times the original edit distance, enabling probabilistic gap detection in the approximation algorithm.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.