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

AD model performance benchmark #722

Merged
merged 1 commit into from
Nov 23, 2022
Merged

Conversation

kaituo
Copy link
Collaborator

@kaituo kaituo commented Nov 11, 2022

Description

This PR adds an AD model performance benchmark so that we can compare model performance across versions.

For the single stream detector, we refactored tests in DetectionResultEvalutationIT and moved it to SingleStreamModelPerfIT.

For the HCAD detector, we randomly generated synthetic data with known anomalies inserted throughout the signal. In particular, these are one/two/four dimensional data where each dimension is a noisy cosine wave. Anomalies are inserted into one dimension with 0.003 probability. Anomalies across each dimension can be independent or dependent. We have approximately 5000 observations per data set. The data set is generated using the same random seed so the result is comparable across versions.

We also backported #600 so that we can capture the performance data in CI output.

Testing done:

  • added unit tests to run the benchmark.

Signed-off-by: Kaituo Li kaituo@amazon.com

Issues Resolved

#719

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2022

Codecov Report

Merging #722 (21e8f42) into 1.3 (09cbdbc) will increase coverage by 0.31%.
The diff coverage is n/a.

❗ Current head 21e8f42 differs from pull request most recent head 05b18ad. Consider uploading reports for the commit 05b18ad to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##                1.3     #722      +/-   ##
============================================
+ Coverage     77.66%   77.97%   +0.31%     
- Complexity     4110     4133      +23     
============================================
  Files           296      296              
  Lines         17673    17687      +14     
  Branches       1882     1884       +2     
============================================
+ Hits          13725    13791      +66     
+ Misses         3041     2999      -42     
+ Partials        907      897      -10     
Flag Coverage Δ
plugin 77.97% <ø> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ransport/DeleteAnomalyDetectorTransportAction.java 51.00% <0.00%> (-0.52%) ⬇️
.../ad/rest/handler/AnomalyDetectorActionHandler.java 6.45% <0.00%> (-0.22%) ⬇️
...d/transport/GetAnomalyDetectorTransportAction.java 60.94% <0.00%> (-0.14%) ⬇️
...c/main/java/org/opensearch/ad/util/ParseUtils.java 70.00% <0.00%> (+0.10%) ⬆️
src/main/java/org/opensearch/ad/model/Entity.java 85.18% <0.00%> (+0.13%) ⬆️
...opensearch/ad/indices/AnomalyDetectionIndices.java 72.28% <0.00%> (+0.18%) ⬆️
...rg/opensearch/ad/AnomalyDetectorProfileRunner.java 68.98% <0.00%> (+0.21%) ⬆️
...in/java/org/opensearch/ad/EntityProfileRunner.java 75.00% <0.00%> (+0.28%) ⬆️
.../main/java/org/opensearch/ad/NodeStateManager.java 72.25% <0.00%> (+0.36%) ⬆️
...org/opensearch/ad/ratelimit/ResultWriteWorker.java 68.57% <0.00%> (+0.45%) ⬆️
... and 7 more

This PR adds a HCAD model performance benchmark so that we can compare model performance across versions.

Regarding benchmark data, we randomly generated synthetic data with known anomalies inserted throughout the signal. In particular, these are one/two/four dimensional data where each dimension is a noisy cosine wave. Anomalies are inserted into one dimension with 0.003 probability. Anomalies across each dimension can be independent or dependent. We have approximately 5000 observations per data set. The data set is generated using the same random seed so the result is comparable across versions.

We also backported opensearch-project#600 so that we can capture the performance data in CI output.

Testing done:
* added unit tests to run the benchmark.

Signed-off-by: Kaituo Li <kaituo@amazon.com>
@@ -670,6 +692,7 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.2'
testCompileOnly 'junit:junit:4.13.2'
implementation group: 'org.javassist', name: 'javassist', version:'3.28.0-GA'
Copy link
Member

Choose a reason for hiding this comment

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

Did you figure out why we suddenly needed this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't. The 1.3 CI started failing due to missing javassit since Oct 5.

@kaituo kaituo merged commit 42095db into opensearch-project:1.3 Nov 23, 2022
@opensearch-trigger-bot
Copy link

The backport to 1.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.x 1.x
# Navigate to the new working tree
cd .worktrees/backport-1.x
# Create a new branch
git switch --create backport/backport-722-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 42095db3e08a767906b269a640080e6c62921c89
# Push it to GitHub
git push --set-upstream origin backport/backport-722-to-1.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.x

Then, create a pull request where the base branch is 1.x and the compare/head branch is backport/backport-722-to-1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants