-
Notifications
You must be signed in to change notification settings - Fork 36
start historical detector #355
start historical detector #355
Conversation
Codecov Report
@@ Coverage Diff @@
## master #355 +/- ##
============================================
+ Coverage 77.22% 78.70% +1.48%
- Complexity 2277 2462 +185
============================================
Files 214 224 +10
Lines 10242 10995 +753
Branches 909 943 +34
============================================
+ Hits 7909 8654 +745
+ Misses 1914 1899 -15
- Partials 419 442 +23
Flags with carried forward coverage won't be shown. Click here to find out more.
|
3a98ede
to
bb1967b
Compare
@@ -0,0 +1,30 @@ | |||
/* | |||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./gradlew spotlessApply
will reset copyright year as 2020 as configured in file spotless.license.java.
To make this PR clean, will send out a separate PR to update this license file and apply to all files. Will replace 2020
with $YEAR
, then spotless can fill as current year automatically.
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndices.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManager.java
Show resolved
Hide resolved
src/test/java/com/amazon/opendistroforelasticsearch/ad/plugin/MockReindexPlugin.java
Show resolved
Hide resolved
96411fe
to
1b6ed34
Compare
1b6ed34
to
0257a36
Compare
src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetector.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only finished one class FeatureManager. Will continue reviewing.
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorPlugin.java
Show resolved
Hide resolved
src/main/java/com/amazon/opendistroforelasticsearch/ad/util/ParseUtils.java
Show resolved
Hide resolved
long endTime | ||
) { | ||
long maxTimeDifference = detector.getDetectorIntervalInMilliseconds() / 2; | ||
Map<Long, Entry<Long, Optional<double[]>>> featuresMap = getNearbyPointsForShingle(detector, shingle, endTime, maxTimeDifference) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to call getNearbyPointsForShingle which helps real time detectors to deal with uneven arrival of requests? You run in batches and your timestamp within an interval is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to handle sparse data, this method is used for imputing missing points in the shingle with neighboring points here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In getNearbyPointsForShingle, the imputing distance is half of the interval, which does not apply to your case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this logic for historical detector?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from product/user experience consideration, we will not differentiate the historical and realtime detection, will keep the model/algorithm consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to impute missing data which caused by run time jitter for historical detector, just need to impute the data hole in source data.
Discussed with kaituo, will simplify the code for historical detector currently. For the single flow, we can create new function to handle both historical and realtime detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems that we have lots of ideas for the new universal workflow. Should we create a doc/issue to track them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, as universal flow is just started, I will doc these ideas on my notebook and share with internal team first. Don't thinks it will benefit community by sharing such unconnected ideas on Github now as we don't even mention what universal flow is. Will create an RFC issue later once we finish research, and put those ideas on that Github issue. So user can know the big picture of background, our solution, then they can understand why we come up with these ideas.
src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java
Outdated
Show resolved
Hide resolved
463fce2
to
d92879e
Compare
d92879e
to
7c9d4b9
Compare
Thanks for the change for FeatureManager, Yaliang. I approve the change to that file. |
Issue #, if available:
Description of changes:
If a detector has detection date range, we call it "historical detector".
Use the same start detector API to start both realtime and historical detector.
AD task states
Test
./gradlew build
./gradlew integTest -PnumNodes=3
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.