Skip to content
Merged
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
69 changes: 66 additions & 3 deletions docs/reference/ingest/processors/inference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ include::common-options.asciidoc[]
// NOTCONSOLE



[discrete]
[[inference-processor-regression-opt]]
==== {regression-cap} configuration options
Expand All @@ -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
Expand All @@ -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]]
Expand Down Expand Up @@ -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:

`<ml.inference.target_field>`.`<inference.tag>`.`feature_importance`

If `inference.tag` is not provided in the processor definition, it is not part
of the field path. The `<ml.inference.target_field>` 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.