DynamicTimeWarping / dtw-python

Python port of R's Comprehensive Dynamic Time Warp algorithms package
https://dynamictimewarping.github.io
GNU General Public License v3.0
279 stars 35 forks source link

"asymmetricP0" without the vertical move? #82

Closed hbredin closed 10 months ago

hbredin commented 10 months ago

I'd like to build a step pattern similar to asymmetricP0 but without the vertical move, like the image below:

image

How would you recommend I do that?

tonigi commented 10 months ago

Try this...

from dtw.stepPattern import StepPattern,  _c

asymmetric1 = StepPattern(_c(
    1, 1, 0, -1,
    1, 0, 0, 1,
    2, 1, 1, -1,
    2, 0, 0, 1,
), "N");

Hence

> print(asymmetric1)
Step pattern recursion:
 g[i,j] = min(
     g[i-1,j  ] +     d[i  ,j  ] ,
     g[i-1,j-1] +     d[i  ,j  ] ,
 ) 

Normalization hint: N
hbredin commented 10 months ago

Thanks a lot!