forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.x] Pipeline Inference Aggregation (elastic#58965)
Adds a pipeline aggregation that loads a model and performs inference on the input aggregation results.
- Loading branch information
Showing
45 changed files
with
2,127 additions
and
189 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
docs/reference/aggregations/pipeline/inference-bucket-aggregation.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[role="xpack"] | ||
[testenv="basic"] | ||
[[search-aggregations-pipeline-inference-bucket-aggregation]] | ||
=== Inference Bucket Aggregation | ||
|
||
A parent pipeline aggregation which loads a pre-trained model and performs inference on the | ||
collated result field from the parent bucket aggregation. | ||
|
||
[[inference-bucket-agg-syntax]] | ||
==== Syntax | ||
|
||
A `inference` aggregation looks like this in isolation: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
{ | ||
"inference": { | ||
"model_id": "a_model_for_inference", <1> | ||
"inference_config": { <2> | ||
"regression_config": { | ||
"num_top_feature_importance_values": 2 | ||
} | ||
}, | ||
"buckets_path": { | ||
"avg_cost": "avg_agg", <3> | ||
"max_cost": "max_agg" | ||
} | ||
} | ||
} | ||
-------------------------------------------------- | ||
// NOTCONSOLE | ||
<1> The ID of model to use. | ||
<2> The optional inference config which overrides the model's default settings | ||
<3> Map the value of `avg_agg` to the model's input field `avg_cost` | ||
|
||
[[inference-bucket-params]] | ||
.`inference` Parameters | ||
[options="header"] | ||
|=== | ||
|Parameter Name |Description |Required |Default Value | ||
| `model_id` | The ID of the model to load and infer against | Required | - | ||
| `inference_config` | Contains the inference type and its options. There are two types: <<inference-agg-regression-opt,`regression`>> and <<inference-agg-classification-opt,`classification`>> | Optional | - | ||
| `buckets_path` | Defines the paths to the input aggregations and maps the aggregation names to the field names expected by the model. | ||
See <<buckets-path-syntax>> for more details | Required | - | ||
|=== | ||
|
||
|
||
==== Configuration options for {infer} models | ||
The `inference_config` setting is optional and usaully isn't required as the pre-trained models come equipped with sensible defaults. | ||
In the context of aggregations some options can overridden for each of the 2 types of model. | ||
|
||
[discrete] | ||
[[inference-agg-regression-opt]] | ||
===== Configuration options for {regression} models | ||
|
||
`num_top_feature_importance_values`:: | ||
(Optional, integer) | ||
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-regression-num-top-feature-importance-values] | ||
|
||
[discrete] | ||
[[inference-agg-classification-opt]] | ||
===== Configuration options for {classification} models | ||
|
||
`num_top_classes`:: | ||
(Optional, integer) | ||
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-classification-num-top-classes] | ||
|
||
`num_top_feature_importance_values`:: | ||
(Optional, integer) | ||
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-classification-num-top-feature-importance-values] | ||
|
||
`prediction_field_type`:: | ||
(Optional, string) | ||
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-classification-prediction-field-type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.