jgraving / pydtw

A python/numpy/cython implementation of dynamic time warping (DTW) for aligning time series.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

A python/numpy/cython implementation of dynamic time warping (DTW) for aligning time series.


Languages

Language:Jupyter Notebook 97.4%Language:Python 2.6%