Skip to content
/ DTW Public

Dynamic Time Warping algorithm written in python

Notifications You must be signed in to change notification settings

cbellei/DTW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DTW - Dynamic Time Warping algorithm in python

author: Claudio Bellei

--------------------
DYNAMIC TIME WARPING
--------------------

> dtw(ts1=[],ts2=[],plot=False,test=False)
Input: ts1, ts2 (timeseries)
Output: cost (distance between the warped time series)

options:
1. plot. If True, plots a few figures.
2. test. If True, uses the test data 
         ts1 = np.cos(2*np.pi*(3*np.arange(1,1001,dtype=float)/1000)**2)
         ts2 = np.cos(2*np.pi*9*np.arange(1,400,dtype=float)/400)

Example

dtw(plot=True,test=True)

The basic test will find the warped distance between the following two functions

ts1 = np.cos(2*np.pi*(3*np.arange(1,1001,dtype=float)/1000)**2)
ts2 = np.cos(2*np.pi*9*np.arange(1,400,dtype=float)/400)

that are plotted below

alt tag

The algorithm leads to the construction of a two-dimensional matrix, from which we can find the warped map between the two time series

alt tag

Finally, the mapping between the red and blue curves can be shown

alt tag

About

Dynamic Time Warping algorithm written in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages