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

feat: Multivariate Anomaly Detection #343

Merged
merged 35 commits into from
Feb 8, 2024
Merged

feat: Multivariate Anomaly Detection #343

merged 35 commits into from
Feb 8, 2024

Conversation

ab93
Copy link
Member

@ab93 ab93 commented Jan 26, 2024

Additions:

  • Beta VAE to balance the KLD and Log likelihood loss
  • RobustMahalanobis Distance for multivariate thresholding
  • Percentile based thresholding with aggregation
  • Allow a tag suffix in docker workflow when using the github UI
  • Exponential moving average in postprocess output
  • Introduce pytests instead of unittests for newer test cases
  • Improve synthetic anomaly generator module
  • Per feature anomaly score when using certain thresholding models
  • Score config for different feature and window aggreation methods

Removal:

  • backtesting cli tool (since this will be added in a separate backtesting tool UI)

s0nicboOm and others added 18 commits December 13, 2023 12:47
Demo branch

---------

Signed-off-by: s0nicboOm <i.kushalbatra@gmail.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
@ab93 ab93 self-assigned this Jan 26, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 57 lines in your changes are missing coverage. Please review.

Comparison is base (2d84876) 93.40% compared to head (644875d) 92.31%.
Report is 1 commits behind head on main.

Files Patch % Lines
numalogic/backtest/_prom.py 62.12% 20 Missing and 5 partials ⚠️
numalogic/synthetic/anomalies.py 69.23% 7 Missing and 1 partial ⚠️
numalogic/transforms/_stateless.py 81.57% 3 Missing and 4 partials ⚠️
numalogic/models/threshold/_median.py 85.36% 3 Missing and 3 partials ⚠️
numalogic/config/factory.py 73.33% 4 Missing ⚠️
numalogic/tools/data.py 50.00% 3 Missing ⚠️
numalogic/udfs/postprocess.py 89.28% 1 Missing and 2 partials ⚠️
numalogic/config/_config.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #343      +/-   ##
==========================================
- Coverage   93.40%   92.31%   -1.10%     
==========================================
  Files          83       82       -1     
  Lines        3853     3918      +65     
  Branches      311      325      +14     
==========================================
+ Hits         3599     3617      +18     
- Misses        197      233      +36     
- Partials       57       68      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
@ab93 ab93 added the area/ml Machine Learning based changes label Jan 29, 2024
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
@ab93 ab93 marked this pull request as ready for review January 29, 2024 23:45
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Copy link
Contributor

@s0nicboOm s0nicboOm left a comment

Choose a reason for hiding this comment

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

Some comments

numalogic/udfs/tools.py Show resolved Hide resolved
numalogic/udfs/postprocess.py Outdated Show resolved Hide resolved
numalogic/udfs/postprocess.py Outdated Show resolved Hide resolved
numalogic/transforms/_stateless.py Show resolved Hide resolved
numalogic/tools/trainer.py Show resolved Hide resolved
numalogic/models/threshold/_median.py Show resolved Hide resolved
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
@ab93 ab93 changed the title feat: Beta VAE feat: Multivariate Anomaly Detection Feb 5, 2024
Copy link
Contributor

@s0nicboOm s0nicboOm left a comment

Choose a reason for hiding this comment

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

minor comments

numalogic/tools/aggregators.py Outdated Show resolved Hide resolved
numalogic/udfs/postprocess.py Outdated Show resolved Hide resolved
numalogic/udfs/postprocess.py Show resolved Hide resolved
numalogic/udfs/postprocess.py Show resolved Hide resolved
numalogic/config/_config.py Show resolved Hide resolved
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Copy link

@qhuai qhuai left a comment

Choose a reason for hiding this comment

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

Share the current set of comments. Still working through files in https://github.com/numaproj/numalogic/blob/main/numalogic/models/vae

numalogic/models/threshold/_mahalanobis.py Show resolved Hide resolved
numalogic/models/threshold/_median.py Show resolved Hide resolved
numalogic/models/threshold/_median.py Show resolved Hide resolved
tests/transforms/test_transforms.py Show resolved Hide resolved
Copy link

@qhuai qhuai left a comment

Choose a reason for hiding this comment

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

Have you evaluated the quality difference between plain VAE v.s. conv1d VAE in anomaly detection?

numalogic/models/vae/variants/conv.py Show resolved Hide resolved
numalogic/transforms/_stateless.py Show resolved Hide resolved
Copy link
Contributor

@s0nicboOm s0nicboOm left a comment

Choose a reason for hiding this comment

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

Some more minor comments.

numalogic/models/threshold/_median.py Outdated Show resolved Hide resolved
numalogic/models/threshold/_median.py Show resolved Hide resolved
numalogic/models/threshold/_median.py Show resolved Hide resolved
numalogic/udfs/factory.py Show resolved Hide resolved
Copy link
Contributor

@s0nicboOm s0nicboOm left a comment

Choose a reason for hiding this comment

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

Also, I am not sure how do we test pytest files. can you add a step in README for it too.

Added some minor comments otherwise LGTM.

@ab93
Copy link
Member Author

ab93 commented Feb 7, 2024

Have you evaluated the quality difference between plain VAE v.s. conv1d VAE in anomaly detection?

Yes, conv1d has much better quantitative scores.

@ab93
Copy link
Member Author

ab93 commented Feb 7, 2024

Also, I am not sure how do we test pytest files. can you add a step in README for it too.

Added some minor comments otherwise LGTM.

Simple make test will work, already in README.

Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
@ab93 ab93 merged commit d8bda0e into main Feb 8, 2024
11 checks passed
@ab93 ab93 deleted the betavae-1 branch February 8, 2024 18:34
SaiSharathReddy pushed a commit to SaiSharathReddy/numalogic that referenced this pull request Apr 29, 2024
Additions:
- Beta VAE to balance the KLD and Log likelihood loss
- RobustMahalanobis Distance for multivariate thresholding
- Percentile based thresholding with aggregation
- Allow a tag suffix in docker workflow when using the github UI
- Exponential moving average in postprocess output
- Introduce pytests instead of unittests for newer test cases
- Improve synthetic anomaly generator module
- Per feature anomaly score when using certain thresholding models
- Score config for different feature and window aggreation methods

Removal:
- backtesting cli tool (since this will be added in a separate
backtesting tool UI)

---------

Signed-off-by: Avik Basu <ab93@users.noreply.github.com>
Co-authored-by: Kushal Batra <34571348+s0nicboOm@users.noreply.github.com>
Signed-off-by: skondakindi <saisharathreddy_kondakindi@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ml Machine Learning based changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants