inference-bucket-aggregation.asciidoc 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[search-aggregations-pipeline-inference-bucket-aggregation]]
  4. === Inference Bucket Aggregation
  5. A parent pipeline aggregation which loads a pre-trained model and performs inference on the
  6. collated result field from the parent bucket aggregation.
  7. [[inference-bucket-agg-syntax]]
  8. ==== Syntax
  9. A `inference` aggregation looks like this in isolation:
  10. [source,js]
  11. --------------------------------------------------
  12. {
  13. "inference": {
  14. "model_id": "a_model_for_inference", <1>
  15. "inference_config": { <2>
  16. "regression_config": {
  17. "num_top_feature_importance_values": 2
  18. }
  19. },
  20. "buckets_path": {
  21. "avg_cost": "avg_agg", <3>
  22. "max_cost": "max_agg"
  23. }
  24. }
  25. }
  26. --------------------------------------------------
  27. // NOTCONSOLE
  28. <1> The ID of model to use.
  29. <2> The optional inference config which overrides the model's default settings
  30. <3> Map the value of `avg_agg` to the model's input field `avg_cost`
  31. [[inference-bucket-params]]
  32. .`inference` Parameters
  33. [options="header"]
  34. |===
  35. |Parameter Name |Description |Required |Default Value
  36. | `model_id` | The ID of the model to load and infer against | Required | -
  37. | `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 | -
  38. | `buckets_path` | Defines the paths to the input aggregations and maps the aggregation names to the field names expected by the model.
  39. See <<buckets-path-syntax>> for more details | Required | -
  40. |===
  41. ==== Configuration options for {infer} models
  42. The `inference_config` setting is optional and usaully isn't required as the pre-trained models come equipped with sensible defaults.
  43. In the context of aggregations some options can overridden for each of the 2 types of model.
  44. [discrete]
  45. [[inference-agg-regression-opt]]
  46. ===== Configuration options for {regression} models
  47. `num_top_feature_importance_values`::
  48. (Optional, integer)
  49. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-regression-num-top-feature-importance-values]
  50. [discrete]
  51. [[inference-agg-classification-opt]]
  52. ===== Configuration options for {classification} models
  53. `num_top_classes`::
  54. (Optional, integer)
  55. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-classification-num-top-classes]
  56. `num_top_feature_importance_values`::
  57. (Optional, integer)
  58. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-classification-num-top-feature-importance-values]
  59. `prediction_field_type`::
  60. (Optional, string)
  61. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=inference-config-classification-prediction-field-type]