-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Add switch to enable model plot annotations independently #70678
Conversation
Pinging @elastic/ml-ui (:ml) |
|
||
useEffect(() => { | ||
if (jobCreator.modelPlot === undefined) { | ||
jobCreator.modelPlot = false; |
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.
I don't think this is needed, modelPlot
is a boolean so this should never be true.
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.
Removed in 1b54be9
this._job_config.model_plot_config.annotations_enabled = true; | ||
} else { | ||
this._job_config.model_plot_config = { | ||
enabled: false, |
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.
i believe this isn't needed, enabled
should default to false
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.
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
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.
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
},
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.
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.
I wonder if we should call these "model change annotations" instead of "model plot annotations"? The 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 ( |
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 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.
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.
Updated in 1b54be9
@@ -243,6 +243,25 @@ export class JobCreator { | |||
); | |||
} | |||
|
|||
public set annotations(enable: boolean) { |
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 would be better named modelPlotAnnotations
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.
Changed it to modelChangeAnnotations
in 1b54be9
x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts
Outdated
Show resolved
Hide resolved
...s/job_details_step/components/advanced_section/components/annotations/annotations_switch.tsx
Outdated
Show resolved
Hide resolved
...mponents/job_details_step/components/advanced_section/components/annotations/description.tsx
Outdated
Show resolved
Hide resolved
- 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; |
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 can now be this._job_config.model_plot_config.enabled = enable
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.
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; |
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.
i don't think this is needed
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.
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; |
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 definitely want to enabling this for all single metric jobs?
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.
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.
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.
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.
💛 Build succeeded, but was flaky
Build metrics
History
To update your PR or re-run it, just comment with: |
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.
Tested and LGTM
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.
LGTM
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
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
Checklist
Delete any items that are not applicable to this PR.