-
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] DF Analytics: Creation wizard part 1 #67564
[ML] DF Analytics: Creation wizard part 1 #67564
Conversation
Pinging @elastic/ml-ui (:ml) |
4be5357
to
d0b23d9
Compare
x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/data_frame_analytics/common/index.ts
Outdated
Show resolved
Hide resolved
...ication/data_frame_analytics/pages/analytics_creation/components/create_step/create_step.tsx
Outdated
Show resolved
Hide resolved
...ta_frame_analytics/pages/analytics_creation/components/details_step/details_step_details.tsx
Outdated
Show resolved
Hide resolved
...ion/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts
Show resolved
Hide resolved
...analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx
Outdated
Show resolved
Hide resolved
...ata_frame_analytics/pages/analytics_creation/components/advanced_step/advanced_step_form.tsx
Outdated
Show resolved
Hide resolved
...ata_frame_analytics/pages/analytics_creation/components/advanced_step/advanced_step_form.tsx
Outdated
Show resolved
Hide resolved
.../data_frame_analytics/pages/analytics_creation/components/advanced_step/hyper_parameters.tsx
Outdated
Show resolved
Hide resolved
.../data_frame_analytics/pages/analytics_creation/components/advanced_step/hyper_parameters.tsx
Outdated
Show resolved
Hide resolved
.../data_frame_analytics/pages/analytics_creation/components/advanced_step/hyper_parameters.tsx
Outdated
Show resolved
Hide resolved
.../data_frame_analytics/pages/analytics_creation/components/advanced_step/hyper_parameters.tsx
Outdated
Show resolved
Hide resolved
'Regularization parameter to prevent overfitting on the training data set. Must be a non negative value', | ||
})} | ||
> | ||
<EuiFieldNumber |
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.
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.
Yes - that's planned for a follow-up as we will need to hit the explain API to validate this area and that requires some refactoring.
.../data_frame_analytics/pages/analytics_creation/components/advanced_step/hyper_parameters.tsx
Show resolved
Hide resolved
...e_analytics/pages/analytics_creation/components/configuration_step/analysis_fields_table.tsx
Outdated
Show resolved
Hide resolved
...ication/data_frame_analytics/pages/analytics_creation/components/create_step/create_step.tsx
Outdated
Show resolved
Hide resolved
|
||
return ( | ||
<Fragment> | ||
<Messages messages={requestMessages} /> |
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.
Maybe we should clear the messages if the user goes back to edit some of the settings to correct the original errors? Otheriwse it can be slighly confusing when the messages are still there when they try to create the job a second time.
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.
Will address in the follow up for getting job cloning working 👌
706f449
to
6dee420
Compare
x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts
Outdated
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.
Great job overall! Added some comments, but nothing major.
@@ -421,7 +436,7 @@ export function getEvalQueryBody({ | |||
|
|||
const searchQueryClone = cloneDeep(searchQuery); | |||
|
|||
if (isResultsSearchBoolQuery(searchQueryClone)) { | |||
if (searchQueryClone && isResultsSearchBoolQuery(searchQueryClone)) { |
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.
As isResultsSearchBoolQuery
is a type guard can we move the check against searchQueryClone &&
inside that function?
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.
Moved in cbdf3d5495501b77667dcb273df7817594782d25
@@ -431,7 +446,7 @@ export function getEvalQueryBody({ | |||
} | |||
|
|||
query = searchQueryClone; | |||
} else if (isQueryStringQuery(searchQueryClone)) { | |||
} else if (searchQueryClone && isQueryStringQuery(searchQueryClone)) { |
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.
As isQueryStringQuery
is a type guard can we move the check against searchQueryClone &&
inside that function?
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 cbdf3d5495501b77667dcb273df7817594782d25
const advancedFirstCol: ListItems[] = []; | ||
const advancedSecondCol: ListItems[] = []; | ||
const advancedThirdCol: ListItems[] = []; | ||
|
||
const hyperFirstCol: ListItems[] = []; | ||
const hyperSecondCol: ListItems[] = []; | ||
const hyperThirdCol: ListItems[] = []; |
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.
Nit: For readability and the ability to write a unit test in isolation we could move all of this list items preparation (also the code below this that set's up the translate strings) to a helper function or custom hook.
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.
Happy to do this in a follow-up 👍
standardizationEnabled, | ||
} = form; | ||
|
||
const isDepVarJob = |
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.
Nit: In another file the same check is called isRegOrClassJob
. We should pick one for consistency or move both usages to a helper function.
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 cbdf3d5495501b77667dcb273df7817594782d25
modelMemoryLimitValidationResult, | ||
]); | ||
|
||
const isRegOrClassJob = |
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.
Nit: In another file the same check is called isDepVarJob
. We should pick one for consistency or move both usages to a helper function.
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 cbdf3d5495501b77667dcb273df7817594782d25
const containsOutlierFieldsCb = ({ name, type }: Field) => | ||
!OMIT_FIELDS.includes(name) && name !== EVENT_RATE_FIELD_ID && BASIC_NUMERICAL_TYPES.has(type); | ||
|
||
const callbacks: any = { |
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.
any
could be something like Record<ANALYSIS_CONFIG_TYPE, (f: Field) => boolean>
.
[ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION]: containsOutlierFieldsCb, | ||
}; | ||
|
||
const messages: any = { |
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.
any
could be something like Record<ANALYSIS_CONFIG_TYPE, JSX.Element>
.
jobConfig?.analysis?.classification !== undefined && | ||
formState.numTopClasses !== undefined | ||
) { | ||
// @ts-ignore |
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.
Can you add a note why the ignore is necessary?
standardization_enabled: formState.standardizationEnabled, | ||
} | ||
); | ||
// @ts-ignore |
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.
Please add a note why the ignore is necessary.
@@ -279,6 +356,11 @@ export function getCloneFormStateFromJobConfig( | |||
resultState.dependentVariable = analysisConfig.dependent_variable; | |||
resultState.numTopFeatureImportanceValues = analysisConfig.num_top_feature_importance_values; | |||
resultState.trainingPercent = analysisConfig.training_percent; | |||
|
|||
if (isClassificationAnalysis(analyticsJobConfig.analysis)) { | |||
// @ts-ignore |
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.
Please add a note why the ignore is necessary.
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.
Functional test changes LGTM 🎉
Checking stability of the test changes in https://kibana-ci.elastic.co/job/kibana+flaky-test-suite-runner/505/ ... For some reason, Jenkins has issues fetching the branches of this fork, so the flaky runner doesn't start. |
key={item.id} | ||
isSelected={isItemSelected(item.id)} | ||
key={item[tableItemId]} | ||
isSelected={isItemSelected(item[tableItemId])} | ||
isSelectable={true} | ||
hasActions={true} | ||
data-test-subj="mlFlyoutJobSelectorTableRow" |
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 should be changed to something like mlCustomSelectionTableRow
. The mlFlyoutJobSelectorTable
type data-test-subj
is used in three places I think in this file.
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 fdf122f9dce26a106075d73672c0510fa95dd2f8
id: 'checkbox', | ||
isCheckbox: true, | ||
textOnly: false, | ||
width: '24px', |
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.
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 to 32px in fdf122f9dce26a106075d73672c0510fa95dd2f8
@@ -157,6 +157,9 @@ export function JobSelectorTable({ | |||
filterDefaultFields={!singleSelection ? JOB_FILTER_FIELDS : undefined} | |||
items={jobs} | |||
onTableChange={(selectionFromTable) => onSelection({ selectionFromTable })} | |||
radioDisabledCheck={(item) => { |
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.
Not related to this PR, but as this file is being touched by this PR, could you set the width
of the first checkbox column to 32px
to stop the selection border being cropped. It is used twice - once for the jobs table, and once for the groups table. It needs to match the width of the euiTableRowCellCheckbox
.
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 to 32px in fdf122f9dce26a106075d73672c0510fa95dd2f8
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.
Latest edits 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.
Latest changes LGTM
fdf122f
to
e984987
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* create newJob route and start of wizard * wip: create configStep component * finish configStep form and details * wip: create andvanced step components * create details step component * createStep component * ensure advanced options are correct for each job type * add validation to each step * use custom table for excludes * move customSelectionTable to shared components * form validation for advanced fields * wip: source index selection modal * add source index preview * update details * ensure advanced parameters added to config on creation * can create job from savedSearch. can set source query in ui * validate source object has supported fields * eslint updates * update tests. comment out clone action for now * add create button to advanced editor * remove deprecated test helper functions * fix translation errors * update help text. read only once job created. * fix functional tests * add nextStepNav to df service for tests * fix excludes table page jump and hyperParameter not showing in details * fix checkbox width for custom table
* create newJob route and start of wizard * wip: create configStep component * finish configStep form and details * wip: create andvanced step components * create details step component * createStep component * ensure advanced options are correct for each job type * add validation to each step * use custom table for excludes * move customSelectionTable to shared components * form validation for advanced fields * wip: source index selection modal * add source index preview * update details * ensure advanced parameters added to config on creation * can create job from savedSearch. can set source query in ui * validate source object has supported fields * eslint updates * update tests. comment out clone action for now * add create button to advanced editor * remove deprecated test helper functions * fix translation errors * update help text. read only once job created. * fix functional tests * add nextStepNav to df service for tests * fix excludes table page jump and hyperParameter not showing in details * fix checkbox width for custom table
Summary
Related meta issue: #66661
This is the first PR for switching over to the new creation wizard.
To be addressed in follow ups:
NOTE:
Cloning action and tests have been commented out for now until cloning has been updated for the new wizard
Adds source selection modal for saved searches/indices:
Config step:
Preview source data:
Shows table of included fields for excludes selection
Additional Options
Job details
Creation
View summary of each step and select to start job immediately
Checklist
Delete any items that are not applicable to this PR.