-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Sakoe-Chiba band constraint #9
base: master
Are you sure you want to change the base?
Conversation
This looks very good. Do you use it for speed up or regularization? I think you could also test the forward pass as follows: use https://github.com/mblondel/soft-dtw/blob/master/sdtw/tests/test_soft_dtw.py#L32 for an example. |
Both, but I use it mostly for speed, since it goes from O(N * N) to O(N * B) where B is the band width.
Good point, will do. |
sdtw/soft_dtw.py
Outdated
self.sakoe_chiba_band = sakoe_chiba_band | ||
|
||
if sakoe_chiba_band >= 0: | ||
assert self.D.shape[0] == self.D.shape[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last question before merge... Why do you need this restriction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simplicity.
I updated the code and removed the restriction.
This PR adds a Sakoe-Chiba band constraint [1], which constrains the path to stay in a band around the diagonal. For now it works only on squared DTW problems.
[1] Sakoe, H., & Chiba, S. (1978). Dynamic programming algorithm optimization for spoken word recognition. IEEE transactions on acoustics, speech, and signal processing, 26(1), 43-49.