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] Use doc links service for more ML pages #86405

Merged
merged 8 commits into from
Dec 22, 2020
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 @@ -54,7 +54,7 @@ export const DecisionPathPopover: FC<DecisionPathPopoverProps> = ({
const {
services: { docLinks },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docLink = docLinks.links.ml.featureImportance;

if (featureImportance.length < 2) {
return <DecisionPathJSONViewer featureImportance={featureImportance} />;
Expand Down Expand Up @@ -106,10 +106,7 @@ export const DecisionPathPopover: FC<DecisionPathPopoverProps> = ({
values={{
predictionFieldName,
linkedFeatureImportanceValues: (
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-feature-importance.html`}
target="_blank"
>
<EuiLink href={docLink} target="_blank">
<FormattedMessage
id="xpack.ml.dataframe.analytics.explorationResults.linkedFeatureImportanceValues"
defaultMessage="feature importance values"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,14 @@ const numClassesTypeMessage = (
/>
);

function getZeroClassesMessage(elasaticUrl: string, version: string) {
function getZeroClassesMessage(elasticUrl: string) {
return (
<FormattedMessage
id="xpack.ml.dataframe.analytics.create.zeroClassesMessage"
defaultMessage="To evaluate the {wikiLink}, select all classes or a value greater than the total number of categories."
values={{
wikiLink: (
<EuiLink
href={`${elasaticUrl}guide/en/machine-learning/${version}/ml-dfanalytics-evaluate.html#ml-dfanalytics-roc`}
target="_blank"
external
>
<EuiLink href={elasticUrl} target="_blank" external>
{i18n.translate('xpack.ml.dataframe.analytics.create.aucRocLabel', {
defaultMessage: 'AUC ROC',
})}
Expand Down Expand Up @@ -136,7 +132,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
const {
services: { docLinks },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const classAucRocDocLink = docLinks.links.ml.classificationAucRoc;

const { setEstimatedModelMemoryLimit, setFormState } = actions;
const { form, isJobCreated, estimatedModelMemoryLimit } = state;
Expand Down Expand Up @@ -422,9 +418,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
helpText={getTopClassesHelpText(selectedNumTopClasses)}
isInvalid={selectedNumTopClasses === 0 || selectedNumTopClassesIsInvalid}
error={[
...(selectedNumTopClasses === 0
? [getZeroClassesMessage(ELASTIC_WEBSITE_URL, DOC_LINK_VERSION)]
: []),
...(selectedNumTopClasses === 0 ? [getZeroClassesMessage(classAucRocDocLink)] : []),
...(selectedNumTopClassesIsInvalid ? [numClassesTypeMessage] : []),
]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const EvaluatePanel: FC<EvaluatePanelProps> = ({ jobConfig, jobStatus, se
return <span>{columnId === ACTUAL_CLASS_ID ? cellValue : accuracy}</span>;
};

const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docLink = docLinks.links.ml.classificationEvaluation;

const showTrailingColumns = columnsData.length > MAX_COLUMNS;
const extraColumns = columnsData.length - MAX_COLUMNS;
Expand Down Expand Up @@ -300,7 +300,7 @@ export const EvaluatePanel: FC<EvaluatePanelProps> = ({ jobConfig, jobStatus, se
iconType="help"
iconSide="left"
color="primary"
href={`${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-classification`}
href={docLink}
>
{i18n.translate(
'xpack.ml.dataframe.analytics.classificationExploration.classificationDocsLink',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
const {
services: { docLinks },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docLink = docLinks.links.ml.regressionEvaluation;
const [trainingEval, setTrainingEval] = useState<Eval>(defaultEval);
const [generalizationEval, setGeneralizationEval] = useState<Eval>(defaultEval);
const [isLoadingTraining, setIsLoadingTraining] = useState<boolean>(false);
Expand Down Expand Up @@ -236,7 +236,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
iconType="help"
iconSide="left"
color="primary"
href={`${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-regression-evaluation`}
href={docLink}
>
{i18n.translate(
'xpack.ml.dataframe.analytics.regressionExploration.regressionDocsLink',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const FeatureImportanceSummaryPanel: FC<FeatureImportanceSummaryPanelProp
return [sortedData, _barSeriesSpec, _showLegend, _chartHeight];
}, [totalFeatureImportance]);

const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docLink = docLinks.links.ml.featureImportance;
const tickFormatter = useCallback((d) => Number(d.toPrecision(3)).toString(), []);

// do not expand by default if no feature importance data
Expand Down Expand Up @@ -256,7 +256,7 @@ export const FeatureImportanceSummaryPanel: FC<FeatureImportanceSummaryPanelProp
iconType="help"
iconSide="left"
color="primary"
href={`${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-feature-importance.html`}
href={docLink}
>
<FormattedMessage
id="xpack.ml.dataframe.analytics.exploration.featureImportanceDocsLink"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const Description: FC = memo(({ children }) => {
const {
services: { docLinks },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-calendars.html`;
const docsUrl = docLinks.links.ml.calendars;
const title = i18n.translate(
'xpack.ml.newJob.wizard.jobDetailsStep.additionalSection.calendarsSelection.title',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const Description: FC = memo(({ children }) => {
const {
services: { docLinks },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-url.html`;
const docsUrl = docLinks.links.ml.customUrls;
const title = i18n.translate(
'xpack.ml.newJob.wizard.jobDetailsStep.additionalSection.customUrls.title',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export const Description: FC<Props> = memo(({ children, validation }) => {
const {
services: { docLinks },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-aggregation.html`;
const docsUrl = docLinks.links.ml.aggregations;
return (
<EuiDescribedFormGroup
title={<h3>{title}</h3>}
Expand Down