inference-bucket-aggregation.asciidoc 2.8 KB

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