ensure class_assignment_objective parameter is cloned correctly (#91507)
This commit is contained in:
parent
8126488021
commit
d9df612495
2 changed files with 13 additions and 8 deletions
|
@ -34,9 +34,10 @@ interface Regression {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Classification {
|
interface Classification {
|
||||||
|
class_assignment_objective?: string;
|
||||||
dependent_variable: string;
|
dependent_variable: string;
|
||||||
training_percent?: number;
|
training_percent?: number;
|
||||||
num_top_classes?: string;
|
num_top_classes?: number;
|
||||||
num_top_feature_importance_values?: number;
|
num_top_feature_importance_values?: number;
|
||||||
prediction_field_name?: string;
|
prediction_field_name?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
DataFrameAnalyticsId,
|
DataFrameAnalyticsId,
|
||||||
DataFrameAnalysisConfigType,
|
DataFrameAnalysisConfigType,
|
||||||
} from '../../../../../../../common/types/data_frame_analytics';
|
} from '../../../../../../../common/types/data_frame_analytics';
|
||||||
|
import { isClassificationAnalysis } from '../../../../../../../common/util/analytics_utils';
|
||||||
import { ANALYSIS_CONFIG_TYPE } from '../../../../../../../common/constants/data_frame_analytics';
|
import { ANALYSIS_CONFIG_TYPE } from '../../../../../../../common/constants/data_frame_analytics';
|
||||||
export enum DEFAULT_MODEL_MEMORY_LIMIT {
|
export enum DEFAULT_MODEL_MEMORY_LIMIT {
|
||||||
regression = '100mb',
|
regression = '100mb',
|
||||||
|
@ -50,6 +51,7 @@ export interface State {
|
||||||
alpha: undefined | number;
|
alpha: undefined | number;
|
||||||
computeFeatureInfluence: string;
|
computeFeatureInfluence: string;
|
||||||
createIndexPattern: boolean;
|
createIndexPattern: boolean;
|
||||||
|
classAssignmentObjective: undefined | string;
|
||||||
dependentVariable: DependentVariable;
|
dependentVariable: DependentVariable;
|
||||||
description: string;
|
description: string;
|
||||||
destinationIndex: EsIndexName;
|
destinationIndex: EsIndexName;
|
||||||
|
@ -126,6 +128,7 @@ export const getInitialState = (): State => ({
|
||||||
alpha: undefined,
|
alpha: undefined,
|
||||||
computeFeatureInfluence: 'true',
|
computeFeatureInfluence: 'true',
|
||||||
createIndexPattern: true,
|
createIndexPattern: true,
|
||||||
|
classAssignmentObjective: undefined,
|
||||||
dependentVariable: '',
|
dependentVariable: '',
|
||||||
description: '',
|
description: '',
|
||||||
destinationIndex: '',
|
destinationIndex: '',
|
||||||
|
@ -278,14 +281,15 @@ export const getJobConfigFromFormState = (
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (jobConfig?.analysis !== undefined && isClassificationAnalysis(jobConfig?.analysis)) {
|
||||||
formState.jobType === ANALYSIS_CONFIG_TYPE.CLASSIFICATION &&
|
if (formState.numTopClasses !== undefined) {
|
||||||
jobConfig?.analysis?.classification !== undefined &&
|
|
||||||
formState.numTopClasses !== undefined
|
|
||||||
) {
|
|
||||||
// @ts-ignore
|
|
||||||
jobConfig.analysis.classification.num_top_classes = formState.numTopClasses;
|
jobConfig.analysis.classification.num_top_classes = formState.numTopClasses;
|
||||||
}
|
}
|
||||||
|
if (formState.classAssignmentObjective !== undefined) {
|
||||||
|
jobConfig.analysis.classification.class_assignment_objective =
|
||||||
|
formState.classAssignmentObjective;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (formState.jobType === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION) {
|
if (formState.jobType === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION) {
|
||||||
const analysis = Object.assign(
|
const analysis = Object.assign(
|
||||||
|
|
Loading…
Reference in a new issue