diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_page_wrapper/exploration_page_wrapper.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_page_wrapper/exploration_page_wrapper.tsx index b03777fef6bd4..de4d1a97f248f 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_page_wrapper/exploration_page_wrapper.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_page_wrapper/exploration_page_wrapper.tsx @@ -144,12 +144,19 @@ export const ExplorationPageWrapper: FC = ({ )} - {isLoadingJobConfig === true && totalFeatureImportance === undefined && } - {isLoadingJobConfig === false && totalFeatureImportance !== undefined && ( - <> - - - )} + {isLoadingJobConfig === true && + jobConfig !== undefined && + totalFeatureImportance === undefined && } + {isLoadingJobConfig === false && + jobConfig !== undefined && + totalFeatureImportance !== undefined && ( + <> + + + )} {isLoadingJobConfig === true && jobConfig === undefined && } {isLoadingJobConfig === false && jobConfig !== undefined && isInitialized === true && ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/total_feature_importance_summary/feature_importance_summary.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/total_feature_importance_summary/feature_importance_summary.tsx index b754e2eeba349..4da96c595bdf7 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/total_feature_importance_summary/feature_importance_summary.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/total_feature_importance_summary/feature_importance_summary.tsx @@ -32,6 +32,9 @@ import { import { useMlKibana } from '../../../../../contexts/kibana'; import { ExpandableSection } from '../expandable_section'; +import { DataFrameAnalyticsConfig } from '../../../../../../../common/types/data_frame_analytics'; +import { getAnalysisType } from '../../../../common'; +import { isClassificationAnalysis, isRegressionAnalysis } from '../../../../common/analytics'; const { euiColorMediumShade } = euiVars; const axisColor = euiColorMediumShade; @@ -69,6 +72,7 @@ const theme: PartialTheme = { export interface FeatureImportanceSummaryPanelProps { totalFeatureImportance: TotalFeatureImportance[]; + jobConfig: DataFrameAnalyticsConfig; } const tooltipContent = i18n.translate( @@ -88,6 +92,7 @@ const calculateTotalMeanImportance = (featureClass: ClassificationTotalFeatureIm export const FeatureImportanceSummaryPanel: FC = ({ totalFeatureImportance, + jobConfig, }) => { const { services: { docLinks }, @@ -189,13 +194,52 @@ export const FeatureImportanceSummaryPanel: FC Number(d.toPrecision(3)).toString(), []); // do not expand by default if no feature importance data - const hasTotalFeatureImportance = useMemo(() => totalFeatureImportance.length > 1, [ - totalFeatureImportance, - ]); + const noDataCallOut = useMemo(() => { + // if no total feature importance data + if (totalFeatureImportance.length === 0) { + // check if it's because num_top_feature_importance_values is set to 0 + if ( + (jobConfig?.analysis && isRegressionAnalysis(jobConfig?.analysis)) || + isClassificationAnalysis(jobConfig?.analysis) + ) { + const analysisType = getAnalysisType(jobConfig.analysis); + if ( + analysisType !== 'unknown' && + jobConfig.analysis[analysisType].num_top_feature_importance_values === 0 + ) { + return ( + + } + /> + ); + } else { + // or is it because the data is uniform + return ( + + } + /> + ); + } + } + } + return undefined; + }, [totalFeatureImportance, jobConfig]); return ( <> - } - /> + noDataCallOut ? ( + noDataCallOut ) : (