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] Add DL anomaly detection algorithm: LSTM-AD #2125

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

itsdivya1309
Copy link
Contributor

Reference Issues/PRs

Issue: #1637

What does this implement/fix? Explain your changes.

Implemented LSTM-AD algorithm for time series anomaly detection.

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

No, it uses tensorflow and scipy.

@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 1, 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

@itsdivya1309 itsdivya1309 marked this pull request as ready for review October 12, 2024 10:27
@SebastianSchmidl SebastianSchmidl added the deep learning Deep learning related label Oct 12, 2024
Copy link
Member

@hadifawaz1999 hadifawaz1999 left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this. So given its a deep learning model, i think its better if we do the same for all deep sub modules like we do in classification and regression deep learning sub modules, meaning:

  • The network would be implemented in the networks module
  • Define the anomaly_detection/deep_learning module instead of putting them all together
  • Define a base deep anomaly detection module like base deep classifier and base deep regressor for common functionalities like saving and loading

@CodeLionX if you prefer getting this in and then we refactor all to become the same as other modules i don't mind, as long as we set the deep anomaly detection as experimental so we can refactor without having to deprecate stuff @TonyBagnall @MatthewMiddlehurst would like your input on this too

@itsdivya1309 itsdivya1309 marked this pull request as draft October 14, 2024 17:04
@SebastianSchmidl
Copy link
Member

I agree with @hadifawaz1999 and I do not see any reason to rush this in. So, if @itsdivya1309 agrees, we can first draft the base deep learning interfaces for anomaly detection before we implement the individual algorithms.

The anomaly_detection module is experimental, so there is no issue with deprecations right now.

@itsdivya1309
Copy link
Contributor Author

itsdivya1309 commented Oct 15, 2024

I agree with @hadifawaz1999 and I do not see any reason to rush this in. So, if @itsdivya1309 agrees, we can first draft the base deep learning interfaces for anomaly detection before we implement the individual algorithms.

The anomaly_detection module is experimental, so there is no issue with deprecations right now.

I am in for the deep learning sub-module and would like to take up the task.

@SebastianSchmidl
Copy link
Member

@itsdivya1309 Sure, happy to have somebody taking care of this! Do you want to create a draft first, and then meet with @hadifawaz1999 to discuss this draft in a dev meeting?

@itsdivya1309
Copy link
Contributor Author

@itsdivya1309 Sure, happy to have somebody taking care of this! Do you want to create a draft first, and then meet with @hadifawaz1999 to discuss this draft in a dev meeting?

Yeah, sure, I am making the changes suggested by @hadifawaz1999 in this branch itself.

@itsdivya1309 itsdivya1309 marked this pull request as ready for review October 15, 2024 16:42
@itsdivya1309
Copy link
Contributor Author

Hi @CodeLionX @hadifawaz1999, I’ve noticed a couple of tests are failing, and I’m unable to fix them. Could you please provide insights on these test failures and how to resolve them?

@hadifawaz1999
Copy link
Member

So basically i think the best thing to do is to keep in mind that if a deep anomaly detection model is forecasting based, like the one this pr implements (if i understand correctly) then at some point it would be better to implement it at as deep learning in forecasting module (once the new forecasting module is ready) and wrap it in anomaly_deteciton/deep_learning as anomaly detector with the whole config needed.

A lot of deep anomaly detection are self-supervised models, mostly representation learning, so given we are planning to start a self supervised module (soon) then these models will implemented in self supervised module and then wrapped into anomaly detection deep learning submodule with the whole config needed

Will take a look soon on the PR to see the network and all and get back to you

@itsdivya1309
Copy link
Contributor Author

So basically i think the best thing to do is to keep in mind that if a deep anomaly detection model is forecasting based, like the one this pr implements (if i understand correctly) then at some point it would be better to implement it at as deep learning in forecasting module (once the new forecasting module is ready) and wrap it in anomaly_deteciton/deep_learning as anomaly detector with the whole config needed.

A lot of deep anomaly detection are self-supervised models, mostly representation learning, so given we are planning to start a self supervised module (soon) then these models will implemented in self supervised module and then wrapped into anomaly detection deep learning submodule with the whole config needed

Will take a look soon on the PR to see the network and all and get back to you

Thanks for the feedback! That sounds like a solid approach. I’ll also keep the self-supervised module in mind for models focused on representation learning.

Looking forward to your review and any specific feedback on the network design. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
anomaly detection Anomaly detection package deep learning Deep learning related enhancement New feature, improvement request or other non-bug code enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants