DTW(Dynamic Time Warping) is a very useful tools for time series analysis. This is a very simple (but not very efficient) c# implementation of DTW, the source code is available at https://gist.github.com/1966342 .
Use the program as below:
double[] x = {9,3,1,5,1,2,0,1,0,2,2,8,1,7,0,6,4,4,5};
double[] y = {1,0,5,5,0,1,0,1,0,3,3,2,8,1,0,6,4,4,5};
SimpleDTW dtw = new SimpleDTW(x,y);
dtw.calculateDTW();
The python implementation is available at https://gist.github.com/3265694 .
from python-dtw import Dtw
import math
dtw = Dtw([1, 2, 3, 4, 6], [1, 2, 3, 5],
distance_func=lambda x, y: math.fabs(x - y))
print dtw.calculate() #calculate the distance
print dtw.get_path() #calculate the mapping path
Use the program as below:
double[] x = {9,3,1,5,1,2,0,1,0,2,2,8,1,7,0,6,4,4,5};
double[] y = {1,0,5,5,0,1,0,1,0,3,3,2,8,1,0,6,4,4,5};
SimpleDTW dtw = new SimpleDTW(x,y);
dtw.calculateDTW();
The python implementation is available at https://gist.github.com/3265694 .
from python-dtw import Dtw
import math
dtw = Dtw([1, 2, 3, 4, 6], [1, 2, 3, 5],
distance_func=lambda x, y: math.fabs(x - y))
print dtw.calculate() #calculate the distance
print dtw.get_path() #calculate the mapping path
Comments
and please i want to ask about the lines written below about the program where can i write them
thanks and please help me because i'm a beginner
and i need this code urgently
thanks
Later on I have written something more powerful - if anyone is interested, here is the code: https://github.com/doblak/ndtw
dtw airport taxi
Detroit Metro Airport Taxi
Metro Airport Taxi Car Services