R-Forge Logo

Welcome to Dynamic Time Warp project!

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

The R Package dtw provides the most complete, freely-available (GPL) implementation of Dynamic Time Warping-type (DTW) algorithms up to date.

Description

The basic DTW algorithm computes the time axis stretch which optimally maps one timeseries (query) onto another (reference); it outputs the remaining cumulative distance between the two, which is widely used e.g. for classification and clustering.

The R implementation in dtw provides:

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:

Plot gallery

Go to a gallery of sample plots (straight out of the examples in the documentation).

Quickstart Example

## A noisy sine wave as query
idx<-seq(0,6.28,len=100);
query<-sin(idx)+runif(100)/10;

## A cosine is for template; sin and cos are offset by 25 samples
template<-cos(idx)

## Find the best match with the canonical recursion formula
library(dtw);
alignment<-dtw(query,template,keep=TRUE);

## Display the warping curve, i.e. the alignment curve
plot(alignment,type="threeway")

## Align and plot with the Rabiner-Juang type VI-c unsmoothed recursion
plot(
    dtw(query,template,keep=TRUE,
	step=rabinerJuangStepPattern(6,"c")),
    type="twoway",offset=-2);

## See the recursion relation, as a figure and text
plot(rabinerJuangStepPattern(6,"c"))
rabinerJuangStepPattern(6,"c")

## And much more!

Installation

To install the latest stable build of the package (hosted at CRAN), issue the following command in the R console (automated installs require R version > 2.6):
> install.packages("dtw");

You are welcome to test the most recent version, hosted at R-forge:
> install.packages("dtw",repos="http://r-forge.r-project.org")

To get started, begin from the installed documentation:
> ?dtw   
> ?plot.dtw

Please find the project summary page.

Licensing

Much effort has gone in developing this package and making it public under the GPL license. Please cite according to citation("dtw") in all publications reporting results obtained with dtw.

Tormene, P.; Giorgino, T.; Quaglini, S.; Stefanelli, M. Matching incomplete time series with dynamic time warping: an algorithm and an application to post-stroke rehabilitation. Artificial Intelligence in Medicine, Volume 45, Issue 1, January 2009, Pages 11-34 doi:10.1016/j.artmed.2008.11.007

This software is distributed under the terms of the GNU General Public License Version 2, June 1991. The terms of this license are in a file called COPYING which you should have received with this software and which can be displayed by RShowDoc("COPYING").

Academic seminars and training

To enjoy a personalized introduction to dtw and its applications, the author will love to give an invited talk at your institution. Please find my e-mail address below.

Custom training seminars and support is also available to companies.


Author:
Toni Giorgino at gmail.com
Computational Biochemistry and Biophysics Lab, Research Unit on Biomedical Informatics (IMIM-GRIB), Parc de Recerca Biomèdica de Barcelona (PRBB), Spain
and
Laboratory for Biomedical Informatics, University of Pavia, Italy


$Id: index.php 232 2009-05-24 14:58:17Z tonig $