Skip to content

[ENH] Add output and equality checks for anomaly detector fit_predict - #3972

Open
MarkDuek wants to merge 4 commits into
aeon-toolkit:mainfrom
MarkDuek:issue/2801
Open

MarkDuek wants to merge 4 commits into
aeon-toolkit:mainfrom
MarkDuek:issue/2801

Conversation

@MarkDuek

@MarkDuek MarkDuek commented Oct 28, 2026 •

Copy link
Copy Markdown

Reference Issues/PRs

Fixes #2801.
Related: #2865

What does this implement/fix? Explain your changes.

  • Consolidates predict and fit_predict output validation in the parent anomaly-detector checks, preserving series- and collection-specific output lengths.
  • Adds an equality check for overridden _fit_predict implementations, comparing both workflows using identically seeded clones and deep_equals.
  • Excludes LOF and PyODAdapter from equality only, retaining their output validation because LOF intentionally uses different in-sample and novelty scores.

Validation: 66 passed, 4 skipped using:

uv run python -m pytest aeon/testing/tests/test_all_estimators.py \
  -k "check_anomaly_detector_output or check_anomaly_detector_fit_predict_equality" \
  -q -rs --reruns 0

Ruff and Black also passed.

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

No.

Any other comments?

Feedback is welcome on the consolidation and exclusion approach. The PyODAdapter exclusion is class-wide, although equivalence depends on its wrapped model.

PR checklist

For all contributions
  • [] I've added myself to the list of contributors, or will use the all-contributors bot after merging.
  • The PR title starts with an appropriate tag ([ENH]).

Co-authored with AI assistance from OpenAI GPT-6.1 Sol. The changes have been reviewed by the author.

Centralize predict and fit_predict output validation for series and collection anomaly detectors.
Add coverage for overridden _fit_predict implementations while preserving existing checks.

Refs aeon-toolkit#2801

Co-authored with OpenAI GPT-6.1 Sol.
Compare fit_predict with fit followed by predict using identically seeded clones and deep_equals.

Exclude LOF and PyODAdapter from equality checks while retaining their output validation.

Validation: 66 passed, 4 skipped.

Refs aeon-toolkit#2801

Co-authored with OpenAI GPT-6.1 Sol.
@aeon-actions-bot aeon-actions-bot Bot added enhancement New feature, improvement request or other non-bug code enhancement testing Testing related issue or pull request labels Oct 28, 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: enhancement.
I have added the following labels to this PR based on the changes made: testing. 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

@MarkDuek
MarkDuek marked this pull request as ready for review October 28, 2026 14:32
@MatthewMiddlehurst

Copy link
Copy Markdown
Member

Consolidates predict and fit_predict output validation in the parent anomaly-detector checks, preserving series- and collection-specific output lengths.

Did not ask for this, and don't think it should be done here if at all.

As mentioned in surrounding discussion I'm not sure this test is applicable since any anomaly detectors of the same kind of LOF (in regards to supervised, unsupervised, semi-superivsed tags) will have the same skip required, because in the current framework that is the correct way to do it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, improvement request or other non-bug code enhancement testing Testing related issue or pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Test anomaly_detection estimator _fit_predict in general testing

2 participants