WETW: Learning Pair-Specific Weighted Euclidean Distances for Efficient DTW Search

WETW introduces a pair‑specific weighted Euclidean distance that, combined with learned embeddings, speeds up DTW‑based time‑series search by an order of magnitude while preserving high recall.

WETW: Learning Pair-Specific Weighted Euclidean Distances for Efficient DTW Search

Introduction

Dynamic Time Warping (DTW) remains the gold‑standard for measuring similarity between misaligned time‑series, but its quadratic cost makes large‑scale search impractical. Recent learned approximations embed series into a fixed‑dimensional space and compare them with a static distance (usually Euclidean). This works well for some datasets but ignores the fact that DTW aligns each pair differently, effectively turning the aligned subsequences into a Euclidean distance over a pair‑specific coordinate selection. The paper WETW: Learning Pair‑Specific Weighted Euclidean Distances for Efficient DTW Search builds on this observation to create a learned distance that adapts to each pair without performing an explicit alignment.

Pair‑Specific Weighted Euclidean Time Warping (WETW)

WETW augments a standard embedding pipeline with a lightweight symmetric neural network that predicts a weight for every embedding dimension per pair. The network takes the two embeddings as input and outputs a weight vector that scales the Euclidean distance, yielding a Weighted Euclidean measure that approximates the true DTW distance for that pair. Because the weight prediction does not require the costly alignment step, the overhead is modest, yet the resulting distance halves the error compared with the best static distance on the same embeddings.

Key components:

  • Weighted Euclidean Series Encoder (WESEE): A multi‑scale temporal feature extractor that preserves timing information often lost in global pooling. WESEE produces fixed‑length embeddings that retain enough structure for the pair‑specific weighting to be effective.
  • Ranking‑aware training: Instead of fitting DTW values alone, the authors add a ranking regularization term that penalizes misordered nearest‑neighbour pairs. This dramatically improves recall, raising it from ~0.79 to ~0.95 on benchmark datasets.
  • Filter‑and‑Verify pipeline (WETW‑FV): WETW first builds a short candidate list using the learned distance, then computes exact DTW only on that shortlist. The final distances are exact, while the overall search is approximate in terms of candidate selection.

Empirical Performance

Across eight public time‑series datasets, WETW‑FV achieves:

  • 11.4× speed‑up over the fastest exact DTW implementation in the UCR Suite, while maintaining a mean recall@10 of 0.93.
  • On very long series (48 K points), the method remains 40× faster than the UCR Suite with a recall@10 of 0.91.
  • The best competing learned baseline reaches only 0.59 recall at comparable speed, highlighting the advantage of pair‑specific weighting and ranking‑aware training.

These results demonstrate that a modest neural network can capture the alignment‑specific nuances that static distances miss, delivering both efficiency and accuracy.

Practical Takeaways

  1. Embedding choice matters: WESEE’s multi‑scale design preserves temporal cues that are crucial for downstream weighting. Existing encoders can be swapped in, but performance may vary.
  2. Pair‑specific weighting is cheap: The symmetric network adds negligible overhead relative to the embedding computation, yet yields substantial accuracy gains.
  3. Ranking loss improves search quality: Optimizing directly for nearest‑neighbour ordering, rather than raw distance regression, aligns the learned model with the ultimate retrieval goal.
  4. Filter‑and‑verify remains exact: By falling back to true DTW on a short shortlist, WETW‑FV guarantees that any reported distance is exact, making it suitable for applications where precision cannot be compromised.

Conclusion

WETW reframes DTW approximation as a pair‑specific weighted Euclidean problem, leveraging learned embeddings and a tiny weighting network to dramatically accelerate similarity search without sacrificing recall. The approach bridges the gap between fast, static embeddings and the alignment‑aware nature of DTW, offering a practical solution for large‑scale time‑series analytics.

Source

Read original source

Why we picked this

Presents a novel learned distance for time‑series, relevant ML research.

← Back to all articles