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] Add switch to enable model plot annotations independently #70678

Merged
merged 7 commits into from
Jul 9, 2020

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Jul 2, 2020

Summary

This P adds an additional switch toggle to enable model plot annotations independently from the model plot. Part of #69538 and is related to #68232

  1. It will have both options on by default for Single Metric jobs, and off by default for the rest

Screen Shot 2020-07-02 at 11 30 27 AM

2) If user does enable model plot without annotations, a prompt will be given to suggest that they turn it on to take advantage of the feature if the allows for it

Screen Shot 2020-07-02 at 6 18 40 PM

Checklist

Delete any items that are not applicable to this PR.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)


useEffect(() => {
if (jobCreator.modelPlot === undefined) {
jobCreator.modelPlot = false;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed, modelPlot is a boolean so this should never be true.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed in 1b54be9

this._job_config.model_plot_config.annotations_enabled = true;
} else {
this._job_config.model_plot_config = {
enabled: false,
Copy link
Member

Choose a reason for hiding this comment

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

i believe this isn't needed, enabled should default to false

Copy link
Member

@jgowdyelastic jgowdyelastic Jul 3, 2020

Choose a reason for hiding this comment

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

both this and public set modelPlot above should have a check to see if all items inside are false, if so, delete model_plot_config.
line 235 above (thanks github for not allowing me to add a comment there) should not now delete model_plot_config if modelPlot is set to false as it will wipe out annotations_enabled

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested trying to create a job where model plot was disabled, but model change annotations were enabled, and if I check in the JSON for the created job, this block which should be there is missing:

  "model_plot_config": {
    "annotations_enabled": true
  },

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I had to do enabled: false there because ModelPlotConfig interface has enabled as required. And you're right James, deleting that was causing the bug Pete ran into. I have updated to delete the model_plot_config object only if both of the enabled and annotations_enabled are false in 1b54be9.

@droberts195
Copy link
Contributor

I wonder if we should call these "model change annotations" instead of "model plot annotations"? The event for these annotations is model_change, and they get created when there's a significant change in the model.

Switching from "Enable model plot annotations" to "Enable model change annotations" would also avoid doubling from 3 to 6 the number of occurrences of "Enable model plot" that @lcawl complained about in #68232 (comment).

const body: Partial<Job> = request.body;

// if annotations is enabled but model plot is not
if (
Copy link
Member

Choose a reason for hiding this comment

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

we shouldn't have additional logic in this endpoint. this should be a simple proxy to the es endpoint and should behave in the exact same way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 1b54be9

@@ -243,6 +243,25 @@ export class JobCreator {
);
}

public set annotations(enable: boolean) {
Copy link
Member

Choose a reason for hiding this comment

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

this would be better named modelPlotAnnotations

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed it to modelChangeAnnotations in 1b54be9

qn895 added 5 commits July 6, 2020 17:36
- Rename to model change annotations
- Delete model_plot_config if all fields are false
- Always explicitly mark if either field are t or f
- Remove API side logic
…tions-create-wizard

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
…tions-create-wizard

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
this._job_config.model_plot_config = {
enabled: true,
};
this._job_config.model_plot_config.enabled = true;
Copy link
Member

Choose a reason for hiding this comment

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

this can now be this._job_config.model_plot_config.enabled = enable

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here fcb1bab

@@ -175,9 +176,11 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
mlLicense.fullLicenseAPIGuard(async (context, request, response) => {
try {
const { jobId } = request.params;
const body: Partial<Job> = request.body;
Copy link
Member

Choose a reason for hiding this comment

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

i don't think this is needed

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed here fcb1bab

@@ -125,6 +125,7 @@ export const Page: FC<PageProps> = ({ existingJobsAndGroups, jobType }) => {

if (jobCreator.type === JOB_TYPE.SINGLE_METRIC) {
jobCreator.modelPlot = true;
jobCreator.modelChangeAnnotations = true;
Copy link
Member

Choose a reason for hiding this comment

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

do we definitely want to enabling this for all single metric jobs?

Copy link
Member Author

@qn895 qn895 Jul 8, 2020

Choose a reason for hiding this comment

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

I think just enabling modelPlot (and omitting modelChangeAnnotations) will actually enable modelChangeAnnotations as well by default on elastic's side so I thought it would be clearer to state modelChangeAnnotations as true on the UI side for consistency.

As for why we wanted both on for SM jobs, the discussion was that we expect annotations to be fairly high volume for high cardinality jobs, but nowhere near as high volume as model plot. So if we can tolerate the volume of model plot, we would probably also want annotations.

Copy link
Member

@jgowdyelastic jgowdyelastic Jul 9, 2020

Choose a reason for hiding this comment

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

I think just enabling modelPlot (and omitting modelChangeAnnotations) will actually enable modelChangeAnnotations as well by default on elastic's side

This is no longer possible with the changes you added in 405c2a7. So if we do want to only enable modelPlot this line could be omitted.

I was asking more from a product design point of view, whether this had been discussed and it sounds like it has.
I was mainly concerned about the noise of the new annotations that will be generated.

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested and LGTM

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

@qn895 qn895 merged commit cf3133a into elastic:master Jul 9, 2020
@qn895 qn895 deleted the model-plot-annotations-create-wizard branch July 9, 2020 14:16
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.

6 participants