A python/numpy/cython implementation of dynamic time warping (DTW) for aligning time series.
Jupyter Notebook Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example_data
pydtw
README.md
example_flu.ipynb
setup.py

README.md

pydtw

A lightweight (and hopefully quick) implementation of dynamic time warping (and visualizations) in python/numpy/cython (some code ported from Pierre Rouanet's implementation).

setup

Compile the cython code with

python setup.py build_ext --inplace

and you should be good to go.

example usage

import pydtw

x0 = <T_0 x D array>
x1 = <T_1 x D array>
dist, cost, path = pydtw.dtw(x0, x1)

where dist is the dtw distance, cost is a T_0 x T_1 matrix of pairwise distances and path is a python list of two numpy arrays that describe the index sets that best align x0 and x1.

See the influenza example for a more concrete usage.