slaypni / fastdtw

A Python implementation of FastDTW
MIT License
777 stars 121 forks source link

bug in __reduce_by_half(x) ? #1

Closed JulienB-78 closed 8 years ago

JulienB-78 commented 8 years ago

I think there is a bug in the shortest function: __reduce_by_half(x). With the current version, only the first half of x is used to compute the reduced vector.

Shouldn't it be something like: def __reduce_by_half(x): return [(x[i] + x[1+i]) / 2 for i in xrange(0, len(x)-len(x)%2, 2)]

dizcza commented 8 years ago

@JulienB-78 , Although I agree with you, I'd change (x[i] + x[1+i]) / 2 to (x[i] + x[1+i]) / 2.0, cause it matters in Python 3.x. I think you can correct it and make a pull request.

slaypni commented 8 years ago

Thank you for pointing it out! I did not notice this issue for many months...