DynamicTimeWarping/dtw-python

Python port of R's Comprehensive Dynamic Time Warp algorithms package

What it solves

This package provides a comprehensive implementation of Dynamic Time Warping (DTW) algorithms, which are used to find the optimal alignment between two time series by stretching or compressing the time axes. This is essential for comparing sequences that may vary in speed or timing, which is useful for tasks like classification and clustering in econometrics, chemometrics, and general time series mining.

How it works

The library implements a family of DTW algorithms that compute the cumulative distance between a query sequence and a reference sequence. It supports a variety of of constraints and matching types:

  • Global Constraints: Supports arbitrary windowing functions such as the Sakoe-Chiba band and the Itakura parallelogram to limit the search space.
  • Local Constraints: Supports various transition types (step patterns) including symmetric, asymmetric, and user-defined slope constraints.
  • Partial Matches: Enables open-begin, open-end, and substring matches for incomplete time series.
  • Multivariate Support: Can align multivariate time series using arbitrary local distance definitions via scipy.spatial.distance.cdist.

Who it’s for

Data scientists, researchers, and analysts working with time series data in Python, particularly those who need a robust, faithful Python equivalent of the R dtw package.

Highlights

  • Comprehensive Feature Set: Includes a variety of well-known step patterns and Rabiner's smoothed variants.
  • C-Core: Utilizes a fast native C core for performance.
  • Citations: Based on established academic research and provides clear citation guidelines for specific algorithms like Minimum Variance Matching (MVM).
  • Visualization: Includes methods for plotting alignments and warping functions in several classic styles.

Related

  • Project
  • Project
  • Project
  • Project
  • Project