-
Notifications
You must be signed in to change notification settings - Fork 930
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
Size of warping path (wp) obtained by Librosa Sub-sequence DTW is larger than expected #1741
Comments
Thanks for the thorough report and sample data. I'm tagging @stefan-balke on this, since he has spent the most time (I believe) with the inner workings of our DTW implementation. At a first glance, my hunch is that this is behaving correctly, and the documentation might be a bit misleading due to over-use of Your step sizes allow for strictly vertical or strictly horizontal movement, and you have So in general, the length of the path is not strictly determined by the length of the input sequences. There are special cases where it is, however, (ie subseq=False with unit steps), and I suspect that what happened here is that we implemented those cases first, wrote the docstring, and then generalized the implementation without revising notation. @stefan-balke does this sound right to you? |
Thank you for your comprehensive feedback. I got your point. Your observation also aligns with that in [Müller, FMP, Springer 2015], where the warping path is shown to consist of L elements, which could be greater or less than N. This highlights the key distinction of subsequence DTW in comparison to diagonal matching, in which the length of the matching subsequence is constrained to be the same length N as the query X: Thank you again. |
Ok, then I think all we need to do is spend a little time revising the docstring here. I'll leave this issue open in case anyone wants to jump on it. |
Hi @bmcfee, sorry, did not get a ping on this one here. Explanations are correct. WP is only N if diagonal matching is enabled. Otherwise it can be longer (max length depends on the step sizes). I will have a look at the doctstring. Best, |
Hi,
I've encountered an issue while utilizing the librosa sub-sequence Dynamic Time Warping (DTW) function. It seems that the size of the obtained warping path (wp) is unexpectedly larger than the expected value of N.
I'm using the following code to compute DTW:
D, wp = librosa.sequence.dtw(
X=patch,
Y=patch_ref,
metric='euclidean',
step_sizes_sigma=[[1, 0], [0, 3], [1, 3]],
weights_mul=np.array([1, 1, 1]),
band_rad=0.25,
subseq=True,
backtrack=True,
)
Where X is an np.ndarray with a shape of (K, N), where K is 13 and N is 100, and Y is an np.ndarray with a shape of (K, M), where K is also 13 but M is 1823.
According to the documentation of librosa.sequence.dtw, the expected shape of the warping path wp should be (N, 2). However, in my specific case, the size of wp is (101, 2), which is unexpected. The size of D in my case is (N,M).
I have enclosed the relevant data with this report. Please see the attached zip file:
dtw_files.zip
librosa.version = '0.9.2'
Your feedback on this would be greatly appreciated.
Thank you,
The text was updated successfully, but these errors were encountered: