Open toinsson opened 2 years ago
Thanks for this great contribution, really appreciate it! :)
I need some time to study and verify it. In the mean time, could you explain this a bit more?
the rounding in the interpolation of the indices (for instance, i_sc = i * N / M) could be formalised. I did not look too much into it.
Rounding, could you explain this a bit more? There is a proper way of computing the interpolated indices, especially with regards to rounding the result of the division between integers. For example, should the result be rounded to the closest integer, or floored or ceiled?
pyts
does seem to have done this with care, i.e. in the function pyts.metrics.sakoe_chiba_band but that is a lot of code : ), and I am not sure I want to spend too much time on these intricacies..
The PR as it is now does it in a naive way, but affords OK results for non-squared matrices (instead of returning inf
).
This could or should be tested against pyts
maybe?
This PR implement some way of using the Sakoe-Chiba bands for non-squared matrices. It does so by computing the approximate diagonal: the indices of the smallest input matrix are interpolated onto the indices of the biggest input matrix. This should address #8 and #18.
The case where N=4, M=7 and bandwidth=1 gives something similar to: D = [ [x, x, -, -, -, -, -] [-, x, x, -, -, -, -] [-, -, -, x, x, -, -] [-, -, -, -, -, x, x] ]
Note that: