Repository navigation
Conversation
|
Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1249 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1243.
With
normalize=False,aampdist_snippetsnever evaluated the last window whenever the series length divided evenly by the subsequence length. Forlen(T) = 8, m = 4it only ever looked at the window starting at index 0, never the one at index 4, and returned[0 0].The window count came from
(n_padded // m) - 1. The- 1was meant to exclude the extra partial window that padding adds when the length does not divide evenly, but it subtracts one in both cases, so an exact fit loses a real window.This counts the full windows from the unpadded length instead (
n_contiguous_windows = len(T) // m) and derives the candidate start indices from the profile matrix, which is the same approach #894 used for the identical bug instumpy/snippets.py. The naive reference intests/naive.pyhad the same off-by-one and is fixed the same way, and there is a new regression test intests/test_aampdist_snippets.py.One thing I noticed while testing: the issue's example expects
[4 0], but that is the normalized path's ranking. After this fix the AAMP path returns[0 4]. Both windows are now selected, which is the bug here; the order differs because AAMP ranks by non-normalized distances. The regression test asserts the selected set rather than the order.Tests: the new regression test fails on main (
D.shape[0]is 1, expected 2) and passes with this change.pytest tests/test_aampdist_snippets.py76 passed,tests/test_snippets.py147 passed, black and flake8 clean.