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] DF Analytics wizard: ensure user can set mml manually or select to use given estimate #81078

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiLink,
EuiSelect,
EuiSpacer,
EuiSwitch,
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -138,7 +139,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;

const { setEstimatedModelMemoryLimit, setFormState } = actions;
const { form, isJobCreated } = state;
const { form, isJobCreated, estimatedModelMemoryLimit } = state;
const {
computeFeatureInfluence,
eta,
Expand All @@ -159,6 +160,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
outlierFraction,
predictionFieldName,
randomizeSeed,
useEstimatedMml,
} = form;

const [numTopClassesOptions, setNumTopClassesOptions] = useState<EuiComboBoxOptionOption[]>([
Expand Down Expand Up @@ -204,7 +206,9 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
if (success) {
if (modelMemoryLimit !== expectedMemory) {
setEstimatedModelMemoryLimit(expectedMemory);
setFormState({ modelMemoryLimit: expectedMemory });
if (useEstimatedMml === true) {
setFormState({ modelMemoryLimit: expectedMemory });
}
}
} else {
// Check which field is invalid
Expand Down Expand Up @@ -481,18 +485,35 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
}
)}
>
<EuiFieldText
placeholder={
jobType !== undefined
? DEFAULT_MODEL_MEMORY_LIMIT[jobType]
: DEFAULT_MODEL_MEMORY_LIMIT.outlier_detection
}
disabled={isJobCreated}
value={modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
<>
<EuiFieldText
placeholder={
jobType !== undefined
? DEFAULT_MODEL_MEMORY_LIMIT[jobType]
: DEFAULT_MODEL_MEMORY_LIMIT.outlier_detection
}
disabled={isJobCreated || useEstimatedMml}
value={useEstimatedMml ? estimatedModelMemoryLimit : modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
<EuiSpacer size="s" />
<EuiSwitch
disabled={isJobCreated}
name="mlDataFrameAnalyticsUseEstimatedMml"
label={i18n.translate('xpack.ml.dataframe.analytics.create.useEstimatedMmlLabel', {
defaultMessage: 'Use estimated model memory limit',
})}
checked={useEstimatedMml === true}
onChange={() =>
setFormState({
useEstimatedMml: !useEstimatedMml,
})
}
data-test-subj="mlAnalyticsCreateJobWizardUseEstimatedMml"
/>
</>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const ConfigurationStepForm: FC<CreateAnalyticsStepProps> = ({
requiredFieldsError,
sourceIndex,
trainingPercent,
useEstimatedMml,
} = form;

const toastNotifications = getToastNotifications();
Expand Down Expand Up @@ -164,7 +165,8 @@ export const ConfigurationStepForm: FC<CreateAnalyticsStepProps> = ({

const debouncedGetExplainData = debounce(async () => {
const jobTypeChanged = previousJobType !== jobType;
const shouldUpdateModelMemoryLimit = !firstUpdate.current || !modelMemoryLimit;
const shouldUpdateModelMemoryLimit =
(!firstUpdate.current || !modelMemoryLimit) && useEstimatedMml === true;
const shouldUpdateEstimatedMml =
!firstUpdate.current || !modelMemoryLimit || estimatedModelMemoryLimit === '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface State {
sourceIndexFieldsCheckFailed: boolean;
standardizationEnabled: undefined | string;
trainingPercent: number;
useEstimatedMml: boolean;
};
disabled: boolean;
indexPatternsMap: SourceIndexMap;
Expand Down Expand Up @@ -161,6 +162,7 @@ export const getInitialState = (): State => ({
sourceIndexFieldsCheckFailed: false,
standardizationEnabled: 'true',
trainingPercent: 80,
useEstimatedMml: true,
},
jobConfig: {},
disabled:
Expand Down