Repository navigation
[MNT] add regression tests for barycentre averaging with derivative distances - #3937
mayuriphad wants to merge 4 commits into
Conversation
The paths of ddtw and wddtw index the derivative series, which has two points fewer, but the barycenter averaging applied them to the original series. The last two points of the Petitjean barycenter were NaN, and the other methods left them unchanged and were off by one. Shift the path by one and add the two end points. Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Thank you for contributing to
|
|
The red Locally the new tests pass (10 passed) on this branch, on this branch merged into current Could a maintainer add the |
…tance-alignment Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
|
The six failures are the new tests seeing the pre-fix behaviour (NaN in the last two points, last column equal to the mean). That's the restored numba cache serving the old compiled |
|
The pytest failures come from the restored numba cache: |
|
thanks for this, #4013 fixes the derivative alignment path indices directly in ddtw_alignment_path and wddtw_alignment_path, so the additional mapping in this PR is no longer required. Please remove _derivative_path_to_original and the associated conversions in _get_alignment_path, but retain the barycentre averaging and KMeans regression tests. These should now pass using the corrected paths from #4013. Please also rebase on main once #4013 is merged and resolve the CI failures. |
… paths aeon-toolkit#4013 returns ddtw and wddtw alignment paths on the original series, so _get_alignment_path no longer needs to shift them. The barycentre and KMeans regression tests stay and now run against those paths. Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
|
Thanks. I merged current main (with #4013) into the branch and removed |
|
The two red |
TonyBagnall
left a comment
There was a problem hiding this comment.
thanks, more coverage always welcome
Reference Issues/PRs
Fixes #3920.
What does this implement/fix? Explain your changes.
ddtw_alignment_pathandwddtw_alignment_pathalign the derivative series, which haven - 2points, so their path indices run from0ton - 3. The barycentre averaging (petitjean,subgradientandkasba) applied those indices to the original series. Two consequences:n - 2andn - 1of the barycentre never got a contribution, so they were0 / 0 = NaN, and every other position was updated from the wrong time point (derivative pointjis centred on original pointj + 1).TimeSeriesKMeans(distance="ddtw", averaging_method="ba")then had NaN centres and could not fit._get_alignment_pathnow maps the path ofddtwandwddtwonto the original series: each pair(j, k)becomes(j + 1, k + 1), and the two end points are added as(0, 0)and(n - 1, m - 1), so every position is covered. The costs are unchanged. The other distances are unchanged.New tests in
aeon/clustering/averaging/tests/test_ba_derivative_distances.py:(0, 0), ends at(n - 1, m - 1)and touches every time point of both series;ddtwandwddtwis finite forpetitjean,subgradientandkasba;TimeSeriesKMeanswithddtw/wddtwandbaaveraging fits with non-empty clusters.8 of the 10 fail on
mainand all pass with the change. The existing tests inaeon/clustering/averaging/tests(263 passed, 50 skipped) and the ESMOTE tests also pass.Does your contribution introduce a new dependency? If yes, which one?
No.
Any other comments?
This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.