From c16c827aa2bafc4d1babfcc8549ec09d7661d265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 15:51:37 +0100 Subject: [PATCH 1/7] [DOCS] Adds feature importance mapping subsection to inference processor docs. --- .../ingest/processors/inference.asciidoc | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index b1b110e2b3889..05966db8b301a 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -34,7 +34,6 @@ include::common-options.asciidoc[] // NOTCONSOLE - [discrete] [[inference-processor-regression-opt]] ==== {regression-cap} configuration options @@ -51,6 +50,7 @@ Specifies the maximum number of importance] values per document. By default, it is zero and no feature importance calculation occurs. + [discrete] [[inference-processor-classification-opt]] ==== {classification-cap} configuration options @@ -73,8 +73,9 @@ Specifies the field to which the top classes are written. Defaults to (Optional, integer) Specifies the maximum number of {ml-docs}/dfa-classification.html#dfa-classification-feature-importance[feature -importance] values per document. By default, it is zero and no feature importance -calculation occurs. +importance] values per document. By default, it is zero and no feature +importance calculation occurs. + [discrete] [[inference-processor-config-example]] @@ -116,3 +117,36 @@ categories for which the predicted probabilities are reported is 2 (`num_top_classes`). The result is written to the `prediction` field and the top classes to the `probabilities` field. Both fields are contained in the `target_field` results object. + + +[discrete] +[[inference-processor-feature-importance]] +==== {feat-imp-cap} object mapping + +Update your index mapping as you can see below to get the full benefit of +aggregating and searching for +{ref}/dfa-classification.html#dfa-classification-feature-importance[{feat-imp}]. + +[source,js] +-------------------------------------------------- +{ + "type": "nested", + "dynamic": true, + "properties": { + "feature_name": { + "type": "keyword" + }, + "importance": { + "type": "double" + } + } +} +-------------------------------------------------- +// NOTCONSOLE + +The mapping field name for {feat-imp} is compounded as follows: + +`ml.`.``.`feature_importance` + +If `inference.tag` is not provided in the processor definition, it is not part +of the field path. The `` defaults to `ml.inference`. \ No newline at end of file From 06e148db62dbd5b705163ffd7e320e751da22873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 16:04:37 +0100 Subject: [PATCH 2/7] [DOCS] Fixes mapping path. --- docs/reference/ingest/processors/inference.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index 05966db8b301a..799334bedee6c 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -149,4 +149,4 @@ The mapping field name for {feat-imp} is compounded as follows: `ml.`.``.`feature_importance` If `inference.tag` is not provided in the processor definition, it is not part -of the field path. The `` defaults to `ml.inference`. \ No newline at end of file +of the field path. The `` defaults to `inference`. \ No newline at end of file From 92bf8e9fe38c025111b0c1d2954ef71530b57f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 16:07:46 +0100 Subject: [PATCH 3/7] [DOCS] Adjusts indentation. --- .../ingest/processors/inference.asciidoc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index 799334bedee6c..08afd533098a4 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -130,16 +130,16 @@ aggregating and searching for [source,js] -------------------------------------------------- { - "type": "nested", - "dynamic": true, - "properties": { - "feature_name": { - "type": "keyword" - }, - "importance": { - "type": "double" - } - } + "type": "nested", + "dynamic": true, + "properties": { + "feature_name": { + "type": "keyword" + }, + "importance": { + "type": "double" + } + } } -------------------------------------------------- // NOTCONSOLE From 4f6c0d614cb59a332d123750e113f2f1765d7292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 16:19:20 +0100 Subject: [PATCH 4/7] [DOCS] Fixes link. --- docs/reference/ingest/processors/inference.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index 08afd533098a4..7495f2fbf67e9 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -125,7 +125,7 @@ classes to the `probabilities` field. Both fields are contained in the Update your index mapping as you can see below to get the full benefit of aggregating and searching for -{ref}/dfa-classification.html#dfa-classification-feature-importance[{feat-imp}]. +{ml-docs}/dfa-classification.html#dfa-classification-feature-importance[{feat-imp}]. [source,js] -------------------------------------------------- From 51990ab7cfd26241e1f9e4a702dd2ab622ed38ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 17:19:22 +0100 Subject: [PATCH 5/7] [DOCS] Addresses feedback. --- .../ingest/processors/inference.asciidoc | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index 7495f2fbf67e9..7fca20ff1ae13 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -123,8 +123,8 @@ classes to the `probabilities` field. Both fields are contained in the [[inference-processor-feature-importance]] ==== {feat-imp-cap} object mapping -Update your index mapping as you can see below to get the full benefit of -aggregating and searching for +Update your index mapping of the {feat-imp} result field as you can see below to +get the full benefit of aggregating and searching for {ml-docs}/dfa-classification.html#dfa-classification-feature-importance[{feat-imp}]. [source,js] @@ -149,4 +149,33 @@ The mapping field name for {feat-imp} is compounded as follows: `ml.`.``.`feature_importance` If `inference.tag` is not provided in the processor definition, it is not part -of the field path. The `` defaults to `inference`. \ No newline at end of file +of the field path. The `` defaults to `inference`. + +For example, you provide a tag `foo` in the definition as you can see below: + +[source,js] +-------------------------------------------------- +{ + "tag": "foo", + ... +} +-------------------------------------------------- +// NOTCONSOLE + + +The `{feat-imp}` value is written to the `ml.inference.foo.feature_importance` +field. + +You can also specify a target field as follows: + +[source,js] +-------------------------------------------------- +{ + "tag": "foo", + "target_field": "my_field" +} +-------------------------------------------------- +// NOTCONSOLE + +In this case, `{feat-imp}` is exposed in the +`ml.my_field.foo.feature_importance` field. \ No newline at end of file From f7d907c5ec9259d65fd3208afc4233eb73fbf978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 17:26:22 +0100 Subject: [PATCH 6/7] [DOCS] Adds field name to the snippet. --- docs/reference/ingest/processors/inference.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index 7fca20ff1ae13..f17ae6a5a25c3 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -129,7 +129,7 @@ get the full benefit of aggregating and searching for [source,js] -------------------------------------------------- -{ +"ml.inference.feature_importance": { "type": "nested", "dynamic": true, "properties": { From de64cf5d6973640abf0252a69829fdaacc8df562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Wed, 25 Mar 2020 17:52:28 +0100 Subject: [PATCH 7/7] [DOCS] Addresses feedback. --- docs/reference/ingest/processors/inference.asciidoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index f17ae6a5a25c3..a97188978dce7 100644 --- a/docs/reference/ingest/processors/inference.asciidoc +++ b/docs/reference/ingest/processors/inference.asciidoc @@ -146,10 +146,10 @@ get the full benefit of aggregating and searching for The mapping field name for {feat-imp} is compounded as follows: -`ml.`.``.`feature_importance` +``.``.`feature_importance` If `inference.tag` is not provided in the processor definition, it is not part -of the field path. The `` defaults to `inference`. +of the field path. The `` defaults to `ml.inference`. For example, you provide a tag `foo` in the definition as you can see below: @@ -178,4 +178,4 @@ You can also specify a target field as follows: // NOTCONSOLE In this case, `{feat-imp}` is exposed in the -`ml.my_field.foo.feature_importance` field. \ No newline at end of file +`my_field.foo.feature_importance` field. \ No newline at end of file