Skip to main content

A comprehensive implementation of dynamic time warping (DTW) algorithms in R. DTW computes the optimal (least cumulative distance) alignment between points of two time series. Common DTW variants covered include local (slope) and global (window) constraints, subsequence matches, arbitrary distance definitions, normalizations, minimum variance matching, and so on. Provides cumulative distances, alignments, specialized plot styles, etc.

Project description

https://img.shields.io/pypi/v/dtw.svg https://img.shields.io/travis/tonigi/dtw.svg Documentation Status

Comprehensive implementation of Dynamic Time Warping algorithms. Supports arbitrary local (eg symmetric, asymmetric, slope-limited) and global (windowing) constraints, fast native code, several plot styles, and more.

Welcome

This package provides the most complete, freely-available (GPL) implementation of Dynamic Time Warping-type (DTW) algorithms up to date. It is a faithful Python equivalent of R’s DTW package.

The package is described in a companion paper, including detailed instructions and extensive background on things like multivariate matching, open-end variants for real-time use, interplay between recursion types and length normalization, history, etc.

Description

DTW is a family of algorithms which compute the local stretch or compression to apply to the time axes of two timeseries in order to optimally map one (query) onto the other (reference). DTW outputs the remaining cumulative distance between the two and, if desired, the mapping itself (warping function). DTW is widely used e.g. for classification and clustering tasks in econometrics, chemometrics and general timeseries mining.

The R implementation in dtw provides:

  • arbitrary windowing functions (global constraints), eg. the Sakoe-Chiba band and the Itakura parallelogram;

  • arbitrary transition types (also known as step patterns, slope constraints, local constraints, or DP-recursion rules). This includes dozens of well-known types:

  • partial matches: open-begin, open-end, substring matches

  • proper, pattern-dependent, normalization (exact average distance per step)

  • the Minimum Variance Matching (MVM) algorithm (Latecki et al.)

Multivariate timeseries can be aligned with arbitrary local distance definitions, leveraging the {proxy}dist function. DTW itself becomes a distance function with the dist semantics.

In addition to computing alignments, the package provides:

  • methods for plotting alignments and warping functions in several classic styles (see plot gallery);

  • graphical representation of step patterns;

  • functions for applying a warping function, either direct or inverse;

  • both fast native (C) and interpreted (R) cores.

Documentation

The best place to learn how to use the package (and a hopefully a decent deal of background on DTW) is the companion paper Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package, which the Journal of Statistical Software makes available for free.

To have a look at how the dtw package is used in domains ranging from bioinformatics to chemistry to data mining, have a look at the list of citing papers.

A link to prebuilt documentation is here.

Citation

If you use dtw, do cite it in any publication reporting results obtained with this software. Please follow the directions given in citation("dtw"), i.e. cite:

Toni Giorgino (2009). Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package. Journal of Statistical Software, 31(7), 1-24, doi:10.18637/jss.v031.i07.

When using partial matching (unconstrained endpoints via the open.begin/open.end options) and/or normalization strategies, please also cite:

Paolo Tormene, Toni Giorgino, Silvana Quaglini, Mario Stefanelli (2008). Matching Incomplete Time Series with Dynamic Time Warping: An Algorithm and an Application to Post-Stroke Rehabilitation. Artificial Intelligence in Medicine, 45(1), 11-34. doi:10.1016/j.artmed.2008.11.007

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2019-08-22)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtw-python-0.5.0.tar.gz (256.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dtw_python-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl (312.5 kB view details)

Uploaded CPython 3.6mmacOS 10.7+ x86-64

File details

Details for the file dtw-python-0.5.0.tar.gz.

File metadata

  • Download URL: dtw-python-0.5.0.tar.gz
  • Upload date:
  • Size: 256.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

File hashes

Hashes for dtw-python-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0395602d50328e9f8e380cec4cae1dee7dccae536ce89cbbabaa7a82c00f9e52
MD5 8a6e39d88eb8fb6176838e10c74a8d8b
BLAKE2b-256 77afed102d3c86b9a6f85b865e7590c40d96669c3ea644c510f3670cc4c4e7b4

See more details on using hashes here.

File details

Details for the file dtw_python-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: dtw_python-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 312.5 kB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

File hashes

Hashes for dtw_python-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b49921dab0d367f5db1d24ca74bb82e2a30a4564cedd2b68ce5d0997b92c32ef
MD5 6684f834d00bc45955eef14d68335357
BLAKE2b-256 645b85a53e4e5e1d80f70d6836a4126e848052e566f1dff0bebdc1812463fd08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page