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

[ML] Adds editor for configuring detector rules #20989

Merged
merged 2 commits into from
Jul 22, 2018

Conversation

peteharverson
Copy link
Contributor

The machine learning model detects statistically anomalous results but it has no knowledge of the meaning of the values being modeled. Rules allow users to supply a detector with domain knowledge that can improve the quality of the results.

This PR adds an editor for viewing, editing and deleting detector rules, launched as an EUI Flyout from the anomalies table links menu.

The 'links' menu on the anomalies table has been relabelled to 'actions':
image

If rules have already been added to a detector, the user is shown a page of options for editing or deleting existing rules:
image

When editing a rule, the user enters the action (skip result or skip model update), plus numerical conditions and / or the categorical scope:
image

Editing a numerical condition:
image

Editing scope, selecting from the configured filter lists (see #20769):
image

Addresses items in #20339. Note this PR does not include functionality for restricting access based on the user's privileges. That will be covered in a separate PR.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💔 Build Failed

import { APPLIES_TO, OPERATOR } from '../../../common/constants/detector_rule';
import { appliesToText, operatorToText } from './utils';

// Rise the popovers above GuidePageSideNav
Copy link
Member

Choose a reason for hiding this comment

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

nit, possible typo? should this be "raise"?


} else {
toastNotifications.addDanger(
`Error obtaining details for job ID ${anomaly.jobId}`);
Copy link
Member

Choose a reason for hiding this comment

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

should the flyout fail to open in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. If the job details cannot be obtained, I'll display an error and not open the flyout:
image



/*
* React modal for validating and saving edits to a rule.
Copy link
Member

Choose a reason for hiding this comment

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

Is this modal complete?
It looks like a WIP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well spotted. I'll remove the save_rule_modal.js file as it isn't needed. The checks it was going to do on save are now done inline, and the Save button is disabled if the edits are not valid e.g. if neither a condition or scope has been added.

import { FILTER_TYPE } from '../../../common/constants/detector_rule';
import { filterTypeToText } from './utils';

// Rise the popovers above GuidePageSideNav
Copy link
Member

Choose a reason for hiding this comment

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

should be "raise"

}) {

const detector = job.analysis_config.detectors[detectorIndex];
const rule = detector.custom_rules[ruleIndex];
Copy link
Member

Choose a reason for hiding this comment

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

does custom_rules always exist?

}

return (
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The PR uses a mix of <div> and <React.Fragment> in different places to wrap components. If the <div> isn't necessary in the DOM it could be replaced with <React.Fragment>.

}

return (
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The PR uses a mix of <div> and <React.Fragment> in different places to wrap components. If the <div> isn't necessary in the DOM it could be replaced with <React.Fragment>.

}

return (
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The PR uses a mix of <div> and <React.Fragment> in different places to wrap components. If the <div> isn't necessary in the DOM it could be replaced with <React.Fragment>.

}

return (
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The PR uses a mix of <div> and <React.Fragment> in different places to wrap components. If the <div> isn't necessary in the DOM it could be replaced with <React.Fragment>.

@walterra
Copy link
Contributor

When creating a rule and adding conditions, it isn't clear in the UI if those conditions are applied using AND or OR.

image

It would be good to put a short clarification in the description and/or link to some documentation.

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

LGTM
I feel this could be revisited later for a bit of restructuring.
moving the edit component out of the flyout component makes sense to me. so we'd have an edit rule component and a list rules component.

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@peteharverson peteharverson merged commit 465ab78 into elastic:master Jul 22, 2018
@peteharverson peteharverson deleted the ml-rules-editor branch July 22, 2018 13:01
peteharverson added a commit to peteharverson/kibana that referenced this pull request Jul 22, 2018
* [ML] Adds editor for configuring detector rules

* [ML] Edits to Rule Editor flyout following review
peteharverson added a commit that referenced this pull request Jul 22, 2018
* [ML] Adds editor for configuring detector rules

* [ML] Edits to Rule Editor flyout following review
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