Skip to content

[REF] Reuse DAMP search kernels in MADRID - #4030

Merged
TonyBagnall merged 4 commits into
aeon-toolkit:mainfrom
hector2394:refactor/madrid-shared-damp
Nov 29, 2026
Merged

TonyBagnall merged 4 commits into
aeon-toolkit:mainfrom
hector2394:refactor/madrid-shared-damp

Conversation

@hector2394

@hector2394 hector2394 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #4028. Follows #3844.

What does this implement/fix? Explain your changes.

MADRID and DAMP maintained separate backward-search and forward-pruning implementations. Move the distance helpers into DAMP and use one single-discord search loop in both estimators. MADRID retains its seeded profiles and thresholds without constructing DAMP estimators or repeating input validation. DAMP's multiple-discord search uses the same backward-search and forward-pruning helpers.

Public parameters, defaults and return formats are unchanged. Add seeded-search and multi-length comparisons, plus a zero-score tie regression.

Does your contribution introduce a new dependency? If yes, which one?

No.

Any other comments?

Validation on Windows with Python 3.12: the full anomaly tests pass with 164 passed and 31 skipped, both estimator doctests pass, all 60 estimator checks pass, file hooks pass, and wheel/source builds pass. The existing 17 exact-profile comparison failures on the baseline pass with the shared single-discord loop, without relaxing their assertions. Scoped mypy checking reports the same six errors as the unmodified baseline.

CI setup also includes the unchanged swapfile repair from #4029 in the three affected workflows. It explicitly creates /swapfile and leaves zram swap active, addressing the setup failure tracked in #4027. Local mocked shell checks cover the old zram failure, regular-file/zram/no-swap setups and fatal setup errors.

Latest CI on 77546b4: 17 checks passed, including the documentation build, 2 skipped and one hosted-runner disconnect. The Ubuntu 3.12 job lost communication with GitHub's server and returned no final test log. The previous Ubuntu 3.13 job ended with the same runner annotation, then passed on the unchanged-code retry. All Ubuntu swap steps passed.

Could a maintainer rerun the failed Ubuntu 3.12 job with diagnostic logging enabled? The contributor account does not have upstream write permission to rerun that job directly. No further empty retry commits are planned without diagnosing the repeated runner loss.

The baseline comparison covers 2,160 output arrays. On nonconstant inputs, locations and pruning rates are unchanged and the largest absolute numerical difference is approximately 7.3e-12. Constant-input results can differ substantially after recompilation of the existing fast-math distance helpers. Both estimators already warn that constant regions give unstable results, and this refactor does not change that handling. Bitwise equivalence is not claimed.

PR checklist

For all contributions
  • I've added myself to the list of contributors. Alternatively, the contributor bot can be used after the PR has been merged.
  • The PR title starts with [REF], indicating a refactoring change.

This pull request includes code written with the assistance of AI.
The code has been reviewed by a human.

Keep seeded multi-length searches on the same numerical path as
single-length detection, without constructing additional estimators.

Co-authored-by: Tony Bagnall <a.j.bagnall@soton.ac.uk>
Co-authored-by: Matthew Middlehurst <pfm15hbu@gmail.com>
@aeon-actions-bot aeon-actions-bot Bot added anomaly detection Anomaly detection package refactor Restructuring without changing its external behavior labels Nov 15, 2026
@aeon-actions-bot

Copy link
Copy Markdown
Contributor

Thank you for contributing to aeon

I have added the following labels to this PR based on the title: refactor.
I have added the following labels to this PR based on the changes made: anomaly detection. Feel free to change these if they do not properly represent the PR.

The Checks tab will show the status of our automated tests. You can click on individual test runs in the tab or "Details" in the panel below to see more information if there is a failure.

If our pre-commit code quality check fails, please run pre-commit locally and push the fixes to your PR branch.

Don't hesitate to ask questions on the aeon Discord channel if you have any.

PR CI actions

These checkboxes will add labels to enable or disable CI functionality for this PR. This may not take effect immediately, and a new commit may be required to run the new configuration.

  • Run pre-commit checks for all files
  • Run mypy typecheck tests
  • Run all pytest tests and configurations
  • Run all notebook example tests
  • Run numba-disabled codecov tests
  • Disable numba cache loading
  • Regenerate expected results for testing
  • Push an empty commit to re-run CI checks

Keep zram devices intact by creating /swapfile explicitly.
Import the shared workflow repair from aeon-toolkit#4029.

Original-commit: da99cdc
@hector2394
hector2394 requested a review from a team as a code owner November 15, 2026 23:13

@TonyBagnall TonyBagnall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks for doing thisd

@TonyBagnall
TonyBagnall merged commit 04cf729 into aeon-toolkit:main Nov 29, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

anomaly detection Anomaly detection package refactor Restructuring without changing its external behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Refactor MADRID to use the standalone DAMP implementation

2 participants