diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx index 830870cf1ca74..41bdc5b8ecf45 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx @@ -61,7 +61,7 @@ export const Page: FC = ({ jobId }) => { const createAnalyticsForm = useCreateAnalyticsForm(); const { state } = createAnalyticsForm; - const { isAdvancedEditorEnabled, disableSwitchToForm } = state; + const { isAdvancedEditorEnabled, disableSwitchToForm, isJobCreated } = state; const { jobType } = state.form; const { initiateWizard, @@ -217,7 +217,7 @@ export const Page: FC = ({ jobId }) => { } > = TRAINING_DOCS_UPPER) { return { id: 'training_percent_high', @@ -281,14 +308,27 @@ async function getValidationCheckMessages( ); } if (depVarValid === true) { - messages.push({ - id: 'dep_var_check', - text: i18n.translate('xpack.ml.models.dfaValidation.messages.depVarSuccess', { - defaultMessage: 'The dependent variable field contains useful values for analysis.', - }), - status: VALIDATION_STATUS.SUCCESS, - heading: dependentVarHeading, - }); + if (analysisType === ANALYSIS_CONFIG_TYPE.REGRESSION) { + messages.push({ + id: 'dep_var_check', + text: i18n.translate('xpack.ml.models.dfaValidation.messages.depVarRegSuccess', { + defaultMessage: + 'The dependent variable field contains continuous values suitable for regression analysis.', + }), + status: VALIDATION_STATUS.SUCCESS, + heading: dependentVarHeading, + }); + } else { + messages.push({ + id: 'dep_var_check', + text: i18n.translate('xpack.ml.models.dfaValidation.messages.depVarClassSuccess', { + defaultMessage: + 'The dependent variable field contains discrete values suitable for classification.', + }), + status: VALIDATION_STATUS.SUCCESS, + heading: dependentVarHeading, + }); + } } else { messages.push(dependentVarWarningMessage); } @@ -306,6 +346,33 @@ async function getValidationCheckMessages( if (analyzedFields.length && analyzedFields.length > INCLUDED_FIELDS_THRESHOLD) { analysisFieldsNumHigh = true; + } else { + if (analysisType === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && analyzedFields.length < 1) { + lowFieldCountWarningMessage.text = i18n.translate( + 'xpack.ml.models.dfaValidation.messages.lowFieldCountOutlierWarningText', + { + defaultMessage: + 'Outlier detection requires that at least one field is included in the analysis.', + } + ); + messages.push(lowFieldCountWarningMessage); + } else if ( + analysisType !== ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && + analyzedFields.length < 2 + ) { + lowFieldCountWarningMessage.text = i18n.translate( + 'xpack.ml.models.dfaValidation.messages.lowFieldCountWarningText', + { + defaultMessage: + '{analysisType} requires that at least two fields are included in the analysis.', + values: { + analysisType: + analysisType === ANALYSIS_CONFIG_TYPE.REGRESSION ? 'Regression' : 'Classification', + }, + } + ); + messages.push(lowFieldCountWarningMessage); + } } if (emptyFields.length) { @@ -318,8 +385,11 @@ async function getValidationCheckMessages( 'xpack.ml.models.dfaValidation.messages.analysisFieldsWarningText', { defaultMessage: - 'Some fields included for analysis have at least {percentEmpty}% empty values. The number of selected fields is high and may result in increased resource usage and long-running jobs.', - values: { percentEmpty: percentEmptyLimit }, + 'Some fields included for analysis have at least {percentEmpty}% empty values. There are more than {includedFieldsThreshold} fields selected for analysis. This may result in increased resource usage and long-running jobs.', + values: { + percentEmpty: percentEmptyLimit, + includedFieldsThreshold: INCLUDED_FIELDS_THRESHOLD, + }, } ); } else if (analysisFieldsEmpty && !analysisFieldsNumHigh) { @@ -336,7 +406,8 @@ async function getValidationCheckMessages( 'xpack.ml.models.dfaValidation.messages.analysisFieldsHighWarningText', { defaultMessage: - 'The number of selected fields is high and may result in increased resource usage and long-running jobs.', + 'There are more than {includedFieldsThreshold} fields selected for analysis. This may result in increased resource usage and long-running jobs.', + values: { includedFieldsThreshold: INCLUDED_FIELDS_THRESHOLD }, } ); } @@ -346,7 +417,8 @@ async function getValidationCheckMessages( id: 'analysis_fields', text: i18n.translate('xpack.ml.models.dfaValidation.messages.analysisFieldsSuccessText', { defaultMessage: - 'The selected analysis fields are sufficiently populated and contain useful data for analysis.', + 'The selected analysis fields are at least {percentPopulated}% populated.', + values: { percentPopulated: (1 - FRACTION_EMPTY_LIMIT) * 100 }, }), status: VALIDATION_STATUS.SUCCESS, heading: analysisFieldsHeading,