On the number of iterations of the DBA algorithm

Frederik Brüning, Anne Driemel, Alperen Ergür, Heiko Röglin

Introduction

The Dynamic Time Warping (DTW) Barycenter Averaging (DBA) algorithm is a cornerstone of modern time series analysis. It serves as the standard heuristic for finding a representative "mean" or "barycenter" for a set of sequences—a task complicated by the fact that time series data, such as heart rates or stock prices, are often out of phase. While DTW elastically aligns these sequences, DBA provides the iterative framework to compute their average.

Despite its widespread adoption and thousands of citations, the theoretical efficiency of DBA has remained largely unexplored. Until recently, it was unknown whether the algorithm could run indefinitely or if it scaled poorly in the worst case. This paper provides the first rigorous analysis of DBA’s convergence, bridging the gap between its theoretical potential for exponential slowdowns and its remarkably fast performance in real-world applications.

Theoretical Analysis: From Worst-Case to Smoothed Complexity

DBA operates similarly to Lloyd’s $k$-means algorithm, alternating between assigning points from input sequences to a mean sequence and updating that mean. However, the elasticity of DTW introduces non-monotonicity: a change in assignment can locally increase a point's distance while decreasing the total sequence distance. This complexity makes standard analysis techniques for $k$-means insufficient.

The Exponential Trap

The authors demonstrate that DBA is not immune to pathological behavior. They prove a worst-case lower bound showing that even with only two input sequences ($n=2$) in 2D space, DBA can be forced into an exponential number of iterations ($2^{\Omega(k)}$) before converging.

Bounding the Complexity

To establish an unconditional upper bound, the researchers turned to real algebraic geometry. By treating the algorithm's state space as a collection of semi-algebraic sets, they were able to bound the maximum possible number of iterations based on the connected components of these sets.

Figure 5: A geometric representation of the semi-algebraic cells used to analyze the state space and bound the number of iterations in the worst-case scenario.

Smoothed Analysis

To explain why the exponential worst-case is rarely seen in practice, the authors employed smoothed analysis. By adding a small amount of Gaussian noise (variance $\sigma^2$) to the input data, they proved that the expected number of iterations becomes bounded. This suggests that the worst-case scenarios are highly fragile and degenerate; even minimal natural variation in real-world data destroys the structures required for exponential runtimes.

Empirical Findings and Real-World Scaling

The study complemented its theoretical proofs with an extensive empirical evaluation using the M5 Competition Dataset (Walmart sales data) and the UCR Time Series Classification Archive.

The results were striking: real-world performance is even more efficient than the smoothed analysis suggests. On the M5 dataset, the number of iterations scaled sublinearly across all parameters:

  • Number of sequences ($n$): Scaled at approximately $O(n^{0.4})$.
  • Sequence length ($m$): Scaled at approximately $O(m^{0.18})$.
  • Mean length ($k$): Scaled at approximately $O(k^{0.5})$.

These findings confirm that DBA is exceptionally well-suited for large-scale data mining, as its practical cost grows much slower than the size of the input data.

Conclusion and Future Work

This research provides the first theoretical foundation for the DBA algorithm, proving that while it can be slow in theory, it is robustly fast in practice. However, a significant gap remains: the current smoothed upper bound still contains an exponential dependency on the number of sequences ($n$).

Future research will focus on sharpening these bounds to achieve a tight polynomial complexity for general $n$ and extending this framework to modern variants like softDBA, shapeDBA, and Fréchet Centering. For now, practitioners can continue using DBA with the confidence that its efficiency is not just a lucky observation, but a mathematically grounded property of the algorithm under realistic conditions.

Summary updated

BibTeX
@article{bruning2025number,
  author = {Frederik Brüning and Anne Driemel and Alperen Ergür and Heiko Röglin},
  title = {{On the number of iterations of the DBA algorithm}},
  journal = {Data Min. Knowl. Discov.},
  year = {2025},
  doi = {10.1007/s10618-025-01116-4},
}
Figure