diff --git a/docs/reference/ingest/processors/inference.asciidoc b/docs/reference/ingest/processors/inference.asciidoc index b1b110e2b38..a97188978dc 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,65 @@ 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 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] +-------------------------------------------------- +"ml.inference.feature_importance": { + "type": "nested", + "dynamic": true, + "properties": { + "feature_name": { + "type": "keyword" + }, + "importance": { + "type": "double" + } + } +} +-------------------------------------------------- +// NOTCONSOLE + +The mapping field name for {feat-imp} is compounded as follows: + +``.``.`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`. + +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 +`my_field.foo.feature_importance` field. \ No newline at end of file