Dynamic Time Warping (DTW) is a fundamental tool in time-series analysis, used extensively in fields ranging from speech recognition to GPS trajectory analysis. Unlike the Fréchet distance, which measures the maximum distance between points on two curves, DTW sums distances along an optimal traversal, making it significantly more robust to outliers. However, a persistent challenge in geometric shape analysis is that standard DTW is not translation-invariant. This paper provides the first rigorous algorithmic framework for computing DTW distance under optimal translation.
The Challenge of Translation Invariance
To compare "shapes" rather than absolute "locations," it is necessary to find a translation $\tau$ that minimizes the distance: $$d_{DTW}^T(\pi, \sigma) = \min_{\tau} d_{DTW}(\pi, \sigma + \tau)$$ While conceptually straightforward, this optimization is computationally difficult. For the Euclidean ($L_2$) norm, even the simplest case—comparing a curve to a single point—is equivalent to the geometric median problem, which has no exact algebraic solution. Consequently, finding an efficient, exact solution for complex curves has remained an open problem.
Methodology
The authors propose two primary strategies depending on the distance metric employed:
Exact Algorithm for the $L_1$ Norm
For the Manhattan distance ($L_1$), the authors identify a structural property: the optimal translation must align at least one coordinate of a vertex in the first curve with a vertex in the second. This observation restricts the search space to $O(n^{2d})$ candidate translations, allowing for an exact algorithm with $O(n^{2(d+1)})$ complexity.
Subcubic Approximation for the $L_2$ Norm
Since an exact $L_2$ solution is algebraically elusive, the focus shifts to a $(1+\epsilon)$-approximation. The authors model DTW as a shortest-path problem in a directed grid graph $G_{DTW}$. As the translation $\tau$ varies, the edge weights in this graph—representing distances between vertices $\pi_i$ and $\sigma_j$—change accordingly.
To achieve a subcubic runtime of $O(n^{2.5}/\epsilon^2)$, the authors employ a z-curve (a space-filling curve) to traverse the translation space. By following this curve, consecutive candidate translations remain geometrically close. This proximity allows for efficient updates to the dynamic shortest-path data structure, amortizing the cost of recomputing the DTW distance across the search space.
Key Insights and Results
The paper's contributions are grounded in several key theoretical insights:
- Lipschitz Continuity: The authors prove that the DTW distance function is $(n+m-1)$-Lipschitz with respect to translation, justifying the use of discretization and approximation schemes.
- Dense Cell Heuristic: They demonstrate that an optimal translation is likely near translations that align multiple vertex pairs, allowing for significant pruning of the search space.
- Computational Hardness: The authors prove that translation-invariant DTW is at least as hard as standard DTW. A sub-quadratic algorithm would contradict the Strong Exponential Time Hypothesis (SETH).
The resulting algorithms represent a significant leap forward. The $L_2$ approximation breaks the cubic barrier, approaching the $O(n^2)$ complexity typically required for a single DTW calculation on fixed curves.
Limitations and Future Work
While $O(n^{2.5})$ is a major improvement, the ultimate goal remains an $O(n^2 \cdot poly(1/\epsilon))$ algorithm. Additionally, this work focuses solely on translation. Extending these rigorous algorithmic techniques to include rotational invariance—a full Procrustes-style analysis—remains a challenging and open area for future research.
Summary updated