Skip to content
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

[ENH] Implemented COPOD for anomaly detection #2202

Merged
merged 15 commits into from
Oct 24, 2024

Conversation

notaryanramani
Copy link
Contributor

Reference Issues/PRs

Fixes #2111

What does this implement/fix? Explain your changes.

Implements COPOD from PyOD to be used in aeon framework along with some test cases.

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

No

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors. Alternatively, you can use the @all-contributors bot to do this for you.
  • The PR title starts with either [ENH], [MNT], [DOC], [BUG], [REF], [DEP] or [GOV] indicating whether the PR topic is related to enhancement, maintenance, documentation, bugs, refactoring, deprecation or governance.
For new estimators and functions
  • I've added the estimator to the online API documentation.
  • (OPTIONAL) I've added myself as a __maintainer__ at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.
For developers with write access
  • (OPTIONAL) I've updated aeon's CODEOWNERS to receive notifications about future changes to these files.

@aeon-actions-bot aeon-actions-bot bot added anomaly detection Anomaly detection package enhancement New feature, improvement request or other non-bug code enhancement labels Oct 14, 2024
@aeon-actions-bot
Copy link
Contributor

Thank you for contributing to aeon

I have added the following labels to this PR based on the title: [ $\color{#FEF1BE}{\textsf{enhancement}}$ ].
I have added the following labels to this PR based on the changes made: [ $\color{#6F6E8D}{\textsf{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, any trivial fixes will automatically be pushed to your PR unless it is a draft.

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

PR CI actions

These checkboxes will add labels to enable/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
  • Stop automatic pre-commit fixes (always disabled for drafts)
  • Disable numba cache loading
  • Push an empty commit to re-run CI checks

Copy link
Member

@SebastianSchmidl SebastianSchmidl left a comment

Choose a reason for hiding this comment

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

Well done. Thank you again!
I still think that the tests are excessive because we already test all cases with the PyODAdapter. Could you boil it down to a couple of tests specific for the COPOD-estimator? In addition, the current tests still refer to iforest 😉

aeon/anomaly_detection/_copod.py Show resolved Hide resolved
aeon/anomaly_detection/_copod.py Outdated Show resolved Hide resolved
aeon/anomaly_detection/_copod.py Outdated Show resolved Hide resolved
aeon/anomaly_detection/_copod.py Show resolved Hide resolved
@notaryanramani
Copy link
Contributor Author

@CodeLionX I am not familiar with COPOD algorithm. Could you please give an idea what kind of tests are required?

@SebastianSchmidl
Copy link
Member

@CodeLionX I am not familiar with COPOD algorithm. Could you please give an idea what kind of tests are required?

I trust that the implementation in PyOD is correct. So, our tests would check that we integrate it in aeon correctly:

  • instantiating the class should work (when pyod is installed): you can just keep one of the end-to-end tests
  • the parameters of the algorithm should be correctly passed down to the PyOD model
  • aeon with window_size=1 and stride=1 should produce the same results as calling the PyOD model directly, when I am not mistaken

TonyBagnall and others added 8 commits October 16, 2024 18:01
* registry refactor

* all_estimators

* comments and qc

* fixes

* fixes

* exclude sklearn in docs

* examples

* examples
* numpy 2

* Update pyproject.toml

* bound

* scipy bound

* correct method

* not 2.1.0

* comment deps

* comment deps

* comment deps

* make numpy 2.0 compatible

* restore current numpy bound

* revert to main pyproject

* Empty commit for CI

---------

Co-authored-by: aadya940 <[email protected]>
Co-authored-by: Tony Bagnall <[email protected]>
Co-authored-by: Tony Bagnall <[email protected]>
Co-authored-by: TonyBagnall <[email protected]>
* split up rocket

* test params

* test params

* test params
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@notaryanramani
Copy link
Contributor Author

Umm... sorry I was trying to rebase the branch and something wild happened 😅. Should I close this PR and open a new one?

Copy link
Member

@SebastianSchmidl SebastianSchmidl left a comment

Choose a reason for hiding this comment

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

Looks good. Just some minor changes so that we don't need to clean it up later 👍🏼

aeon/anomaly_detection/__init__.py Outdated Show resolved Hide resolved
aeon/anomaly_detection/tests/test_copod.py Outdated Show resolved Hide resolved
aeon/anomaly_detection/tests/test_copod.py Outdated Show resolved Hide resolved
@TonyBagnall
Copy link
Contributor

great, thanks for this

@TonyBagnall TonyBagnall merged commit 43f8af0 into aeon-toolkit:main Oct 24, 2024
15 checks passed
@notaryanramani notaryanramani deleted the issue2111 branch October 26, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
anomaly detection Anomaly detection package enhancement New feature, improvement request or other non-bug code enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] Add PyODAdapter-implementation for COPOD
5 participants