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

Add feature attribution #296

Merged
merged 9 commits into from
Aug 5, 2022
Merged

Add feature attribution #296

merged 9 commits into from
Aug 5, 2022

Conversation

jackiehanyang
Copy link
Collaborator

@jackiehanyang jackiehanyang commented Aug 5, 2022

Description

[Describe what this change achieves]
UI changes:

  • in anomaly result chart, show feature contribution of this anomaly with RectAnnotation component
  • in feature break down chart, show expected value when there's an anomaly and current value when there's no anomaly as an additional on the chart
  • swap feature break down tab with anomaly occurrence tab to make it the default selected tab

Issues Resolved

opensearch-project/anomaly-detection#299

[List any issues this PR will resolve]

Check List

  • New functionality includes testing. Tested on localhost
    • All tests pass. will add more tests in the upcoming pr
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff
    Screen Shot 2022-08-05 at 2 32 50 PM
    Screen Shot 2022-08-05 at 1 42 56 PM

Screen Shot 2022-08-05 at 2 32 43 PM

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.

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
@jackiehanyang jackiehanyang requested a review from a team August 5, 2022 09:27
Copy link
Collaborator

@sean-zheng-amazon sean-zheng-amazon left a comment

Choose a reason for hiding this comment

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

overall looks good. sync'ed offline, may need to make minor adjustments to improve consistency.

<LineSeries
id={"ExpectedValue"}
name={"Expected Value"}
color={"#0475a2"}
Copy link
Member

Choose a reason for hiding this comment

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

What is this color? Can you add a comment in the code about it somewhere? If supposed to be invisible, may need to find a way to always keep it consistent with the chart background, including if Dashboards is in dark mode or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a bluish color and shouldn't be invisible. I need to attend the UX office hour next Tuesday to get this color finalized.

Copy link
Member

Choose a reason for hiding this comment

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

Ok - is there a way for you to work with them sooner? Concern is that 8/9 is scheduled as the final sanity testing day - see timeline opensearch-project/opensearch-build#2271

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, will reach out to them offline to draw an conclusion on this

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
ohltyler
ohltyler previously approved these changes Aug 5, 2022
Copy link
Member

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

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

Overall ok with the current changes - have a couple days buffer for finishing up. Thanks for adding this!

@ohltyler
Copy link
Member

ohltyler commented Aug 5, 2022

Also, if you can clean up the PR description and add some screenshots of the changes in the chart that would be great.

Or could rename this PR to specify that this is just adding the expected value and feature contribution to the anomaly result schema, and future PR to enable it in the charts.

@ohltyler
Copy link
Member

ohltyler commented Aug 5, 2022

There's also some integ test failures - I'm assuming it is related to switching the default anomaly history tabs

       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  plugins/anomaly-detection-dashboard      01:04        1        1        -        -        - │
  │    s-plugin/create_detector_spec.js                                                            │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  plugins/anomaly-detection-dashboard      01:07        8        8        -        -        - │
  │    s-plugin/dashboard_spec.js                                                                  │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖  plugins/anomaly-detection-dashboard      01:57        5        4        1        -        - │
  │    s-plugin/detector_configuration_spe                                                         │
  │    c.js                                                                                        │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  plugins/anomaly-detection-dashboard      01:35       11       11        -        -        - │
  │    s-plugin/detector_list_spec.js                                                              │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖  plugins/anomaly-detection-dashboard      04:37        6        2        4        -        - │
  │    s-plugin/historical_analysis_spec.j                                                         │
  │    s                                                                                           │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖  plugins/anomaly-detection-dashboard      02:31        6        4        2        -        - │
  │    s-plugin/overview_spec.js                                                                   │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖  plugins/anomaly-detection-dashboard      01:24        3        -        1        -        2 │
  │    s-plugin/real_time_results_spec.js                                                          │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖  plugins/anomaly-detection-dashboard      03:41        3        -        3        -        - │
  │    s-plugin/sample_detector_spec.js                                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>

const featureData = get(anomaly, `features`, {})
let featureAttributionList = [] as any[];
if (Array.isArray(contributionData)) {
Copy link
Member

Choose a reason for hiding this comment

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

when would contributions not be an array?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

when it's getting response by calling search result api route in stead of get detector result api route

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what you mean about get detector result api route. I see the parsing you've done in getAnomalyResults(). Where does the parsing happen where it is an array instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there's no parsing for that route because it's processed at receiving response stage. See line 964 in ad.ts file, a type was defined and returned with response data

Copy link
Member

@ohltyler ohltyler Aug 5, 2022

Choose a reason for hiding this comment

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

I'm still unsure when contributions would be an array. Even AnomalyResult defines it as a map here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
…t have this field

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Copy link
Member

@amitgalitz amitgalitz left a comment

Choose a reason for hiding this comment

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

LGTM on my end, made sure to keep track of what needs to be refactored/cleaned up in next PR. Will check out if I need to review/approve again if you need to address more of Tyler's comments

Copy link
Member

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

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

Overall LGTM, thanks for making the changes! Let's follow up on #296 (comment)

@ohltyler ohltyler merged commit d973b8e into opensearch-project:main Aug 5, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 5, 2022
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
(cherry picked from commit d973b8e)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 5, 2022
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
(cherry picked from commit d973b8e)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 5, 2022
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
(cherry picked from commit d973b8e)
ohltyler pushed a commit that referenced this pull request Aug 5, 2022
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
(cherry picked from commit d973b8e)
ohltyler pushed a commit that referenced this pull request Aug 5, 2022
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
(cherry picked from commit d973b8e)
@ohltyler ohltyler added the enhancement New feature or request label Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants