NeuralWarp: Time-Series Similarity with Warping Networks

Josif Grabocka, Lars Schmidt-ThiemearXiv 2018

Introduction

Measuring similarity between time series is a fundamental challenge in data science, complicated by temporal variations where patterns may be shifted, stretched, or compressed. Traditional approaches like Dynamic Time Warping (DTW) handle these "elastic" transformations through non-parametric algorithms but fail to leverage the representational power of modern deep learning. Conversely, standard Siamese neural networks often ignore temporal elasticity, relying on simple distance metrics in a latent space. NeuralWarp bridges this gap by introducing a learnable warping mechanism directly into a deep Siamese architecture.

The Challenge of Temporal Elasticity

The core difficulty in time-series comparison lies in its non-linear nature. For instance, two audio recordings of the same word spoken at different speeds should be considered similar, yet a point-to-point Euclidean distance would fail to capture this. While DTW addresses this by finding an optimal alignment, it is "static"—it cannot learn specific features or contexts from a dataset. Modern deep learning models project time series into latent spaces but typically lack an explicit mechanism to model how different time steps should align, often treating the series as rigid vectors.

Methodology: The NeuralWarp Framework

NeuralWarp employs a Siamese architecture consisting of two primary components:

  1. Encoder Network: This component transforms raw time-series data into high-dimensional "context vectors." The authors found that encoders (CNNs or RNNs) are essential because raw values are often ambiguous; the encoder provides the necessary context (e.g., identifying a "rising trend") to determine if two points across different series are truly equivalent.
  2. Warping Network (The "Warper"): The central innovation is a small, fully-connected neural network $\Phi$. Instead of a fixed algorithm, $\Phi$ takes pairs of context vectors from two series and outputs a probability (0 to 1) indicating whether those indices should be aligned.

The final similarity score is a weighted sum of the distances between all pairs of latent vectors, where the weights are the alignment probabilities provided by the Warper. The entire system is trained end-to-end using a logistic loss function on labeled pairs of similar and dissimilar series.

Key Insights

  • Contextual Disambiguation: Training a warping function on raw values is ineffective because identical values can represent different states depending on their temporal context. Deep encoders are required to "disambiguate" these points.
  • RNN Superiority: While both CNN and RNN encoders were tested, LSTM-based encoders performed better. RNN hidden states naturally accumulate the "history" of a pattern, providing a richer context for the Warper than the local receptive fields of a CNN.
  • Optimization Efficiency: The inclusion of the warping mechanism actually speeds up convergence. The "elasticity" provided by the Warper makes the optimization landscape easier for the network to navigate compared to standard "un-warped" Siamese networks.

Experimental Results

The authors evaluated NeuralWarp across four diverse datasets: Satellite (geographical reflectance), Google Speech (audio), Crop (univariate satellite imagery), and HAR (Human Activity Recognition).

  • Accuracy Gains: NeuralWarp with an RNN encoder (RNN-W) consistently outperformed both DTW and standard deep learning models. On the complex HAR dataset, RNN-W achieved 97.19% accuracy, a massive improvement over DTW’s 75.00%.
  • Efficiency: The Warper network is remarkably parameter-efficient, adding only about 1% to the total model size while significantly boosting performance.
  • Classification vs. Similarity: Interestingly, the similarity-based RNN-W model achieved higher classification accuracy via Nearest Neighbor than an RNN trained directly for classification, suggesting that learning similarity is a powerful proxy for learning class boundaries.

Limitations and Future Outlook

Despite its performance, NeuralWarp introduces computational overhead. The "all-pairs" calculation required for the warping matrix makes backpropagation roughly 1.5x to 2x slower than standard models. Future work may focus on scaling this approach to massive datasets through efficient alignment approximations or applying NeuralWarp to optimize cluster centroids in deep latent spaces.

Summary updated

BibTeX
@misc{grabocka2018neuralwarp,
  author = {Josif Grabocka and Lars Schmidt-Thieme},
  title = {{NeuralWarp: Time-Series Similarity with Warping Networks}},
  year = {2018},
  eprint = {1812.08306},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.08306},
}
Figure