Dynamic Time Wrapping (DTW) is a widely used algorithm for measuring similarities between two time series. It is especially valuable in a wide variety of applications, such as clustering, anomaly detection, classification, or video segmentation, where the time-series have different timescales, are irregularly sampled, or are shifted. However, it is not prone to be considered as a loss function in an end-to-end learning framework because of its non-differentiability and its quadratic temporal complexity. While differentiable variants of DTW have been introduced by the community, they still present some drawbacks: computing the distance is still expensive and this similarity tends to blur some differences in the time-series. In this paper, we propose a fast and differentiable approximation of DTW by comparing two architectures: the first one for learning an embedding in which the Euclidean distance mimics the DTW, and the second one for directly predicting the DTW output using regression. We build the former by training a siamese neural network to regress the DTW value between two time-series. Depending on the nature of the activation function, this approximation naturally supports differentiation, and it is efficient to compute. We show, in a time-series retrieval context on EEG datasets, that our methods achieve at least the same level of accuracy as other DTW main approximations with higher computational efficiency. We also show that it can be used to learn in an end-to-end setting on long time series by proposing generative models of EEGs.
翻译:动态时间弯曲(DTW)是一种广泛用于衡量两段时间序列相似度的算法。它在聚类、异常检测、分类或视频分割等众多应用中具有重要价值——这些应用中的时间序列具有不同时间尺度、采样不规则或存在偏移。然而,由于DTW的不可微性以及其二次时间复杂性,难以将其作为端到端学习框架中的损失函数。尽管学界已提出DTW的可微变体,但它们仍存在缺陷:计算距离的代价依然高昂,且这种相似度容易模糊时间序列中的某些差异。本文通过对比两种架构提出一种快速可微的DTW近似方法:第一种架构用于学习一种嵌入表示,使得其中欧氏距离与DTW相似度匹配;第二种架构通过回归直接预测DTW输出值。我们通过训练孪生神经网络回归两段时间序列的DTW值来构建前者。根据激活函数的性质,这种近似自然支持微分且计算高效。在脑电数据集上的时间序列检索实验中,我们证明该方法在达到与其它主流DTW近似方法相同精度的同时,具有更高的计算效率。我们还通过提出脑电图生成模型展示了该方法在长时间序列端到端学习中的应用潜力。