All Projects → keonlee9420 → Soft-DTW-Loss

keonlee9420 / Soft-DTW-Loss

Licence: MIT license
PyTorch implementation of Soft-DTW: a Differentiable Loss Function for Time-Series in CUDA

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Soft-DTW-Loss

Tslearn
A machine learning toolkit dedicated to time-series data
Stars: ✭ 1,910 (+2413.16%)
Mutual labels:  time-series, dtw, dynamic-time-warping
pytorch-softdtw-cuda
Fast CUDA implementation of (differentiable) soft dynamic time warping for PyTorch using Numba
Stars: ✭ 357 (+369.74%)
Mutual labels:  dynamic-time-warping, soft-dtw
DTW
Dynamic Time Warping in Python / C (using ctypes)
Stars: ✭ 26 (-65.79%)
Mutual labels:  time-series, dtw
similarity measures
Quantify the difference between two arbitrary curves in space
Stars: ✭ 140 (+84.21%)
Mutual labels:  dtw, dynamic-time-warping
Fred
A fast, scalable and light-weight C++ Fréchet distance library, exposed to python and focused on (k,l)-clustering of polygonal curves.
Stars: ✭ 13 (-82.89%)
Mutual labels:  time-series, dynamic-time-warping
sktime-tutorial-pydata-amsterdam-2020
Introduction to Machine Learning with Time Series at PyData Festival Amsterdam 2020
Stars: ✭ 115 (+51.32%)
Mutual labels:  time-series
openPDC
Open Source Phasor Data Concentrator
Stars: ✭ 109 (+43.42%)
Mutual labels:  time-series
pyRiemann
Python machine learning package based on sklearn API for multivariate data processing and statistical analysis of symmetric positive definite matrices via Riemannian geometry
Stars: ✭ 470 (+518.42%)
Mutual labels:  time-series
ForestCoverChange
Detecting and Predicting Forest Cover Change in Pakistani Areas Using Remote Sensing Imagery
Stars: ✭ 23 (-69.74%)
Mutual labels:  time-series
data-viz-utils
Functions for easily making publication-quality figures with matplotlib.
Stars: ✭ 16 (-78.95%)
Mutual labels:  time-series
Awesome-Human-Activity-Recognition
An up-to-date & curated list of Awesome IMU-based Human Activity Recognition(Ubiquitous Computing) papers, methods & resources. Please note that most of the collections of researches are mainly based on IMU data.
Stars: ✭ 72 (-5.26%)
Mutual labels:  time-series
AutoTS
Automated Time Series Forecasting
Stars: ✭ 665 (+775%)
Mutual labels:  time-series
covid19-time-series-utilities
several utilities to help wrangle COVID-19 data into a time-series format
Stars: ✭ 34 (-55.26%)
Mutual labels:  time-series
AC-VRNN
PyTorch code for CVIU paper "AC-VRNN: Attentive Conditional-VRNN for Multi-Future Trajectory Prediction"
Stars: ✭ 21 (-72.37%)
Mutual labels:  time-series
Trajectory-Analysis-and-Classification-in-Python-Pandas-and-Scikit-Learn
Formed trajectories of sets of points.Experimented on finding similarities between trajectories based on DTW (Dynamic Time Warping) and LCSS (Longest Common SubSequence) algorithms.Modeled trajectories as strings based on a Grid representation.Benchmarked KNN, Random Forest, Logistic Regression classification algorithms to classify efficiently t…
Stars: ✭ 41 (-46.05%)
Mutual labels:  dtw
timemachines
Predict time-series with one line of code.
Stars: ✭ 342 (+350%)
Mutual labels:  time-series
wv
⏰ This R package provides the tools to perform standard and robust wavelet variance analysis for time series (signal processing). Among others, aside from computing the wavelet variance and cross-covariance (classic and robust), the package provides inference tools (e.g. confidence intervals) and plotting tools allowing to perform some visual an…
Stars: ✭ 14 (-81.58%)
Mutual labels:  time-series
mtss-gan
MTSS-GAN: Multivariate Time Series Simulation with Generative Adversarial Networks (by @firmai)
Stars: ✭ 77 (+1.32%)
Mutual labels:  time-series
awesome-Python-data-science-books
Probably the best curated list of data science books in Python
Stars: ✭ 331 (+335.53%)
Mutual labels:  time-series
go-time-series
Time series implementation in Go
Stars: ✭ 27 (-64.47%)
Mutual labels:  time-series

Soft DTW Loss Function for PyTorch in CUDA

This is a Pytorch Implementation of Soft-DTW: a Differentiable Loss Function for Time-Series which is batch supported computation, CUDA-friendly, and feasible to use as a final loss. I can confirm that you can train a (sequential) model with this as a final loss! The following image shows training logs of a TTS model using the Soft-DTW Loss Function.

There are some previous implementations:

  1. mblondel's soft-dtw
  2. lyprince's sdtw_pytorch
  3. Maghoumi's pytorch-softdtw-cuda

But they are either not supported by CUDA-friendly batch computation or not considering the jacobean w.r.t input matrix, which is necessary to be used as a final loss in recent deep learning frameworks. In the current implementation, all conditions are satisfied.

Usage

Same as Maghoumi's pytorch-softdtw-cuda:

from sdtw_cuda_loss import SoftDTW

# Create the sequences
batch_size, len_x, len_y, dims = 8, 15, 12, 5
x = torch.rand((batch_size, len_x, dims), requires_grad=True)
y = torch.rand((batch_size, len_y, dims))

# Create the "criterion" object
sdtw = SoftDTW(use_cuda=True, gamma=0.1)

# Compute the loss value
loss = sdtw(x, y)  # Just like any torch.nn.xyzLoss()

# Aggregate and call backward()
loss.mean().backward()

But the backward will compute the gradient w.r.t input target sequence x (which is not considered in the previous work).

Note

In the current implementation, only use_cuda=True is supported. But you can easily implement the CPU version as in Maghoumi's pytorch-softdtw-cuda.

Citation

@misc{lee2021soft_dtw_loss,
  author = {Lee, Keon},
  title = {Soft-DTW-Loss},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/keonlee9420/Soft-DTW-Loss}}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].