inference.asciidoc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[inference-processor]]
  4. === {infer-cap} Processor
  5. Uses a pre-trained {dfanalytics} model to infer against the data that is being
  6. ingested in the pipeline.
  7. [[inference-options]]
  8. .{infer-cap} Options
  9. [options="header"]
  10. |======
  11. | Name | Required | Default | Description
  12. | `model_id` | yes | - | (String) The ID of the model to load and infer against.
  13. | `target_field` | no | `ml.inference.<processor_tag>` | (String) Field added to incoming documents to contain results objects.
  14. | `field_mappings` | yes | - | (Object) Maps the document field names to the known field names of the model.
  15. | `inference_config` | yes | - | (Object) Contains the inference type and its options. There are two types: <<inference-processor-regression-opt,`regression`>> and <<inference-processor-classification-opt,`classification`>>.
  16. include::common-options.asciidoc[]
  17. |======
  18. [source,js]
  19. --------------------------------------------------
  20. {
  21. "inference": {
  22. "model_id": "flight_delay_regression-1571767128603",
  23. "target_field": "FlightDelayMin_prediction_infer",
  24. "field_mappings": {},
  25. "inference_config": { "regression": {} },
  26. "model_info_field": "ml"
  27. }
  28. }
  29. --------------------------------------------------
  30. // NOTCONSOLE
  31. [discrete]
  32. [[inference-processor-regression-opt]]
  33. ==== {regression-cap} configuration options
  34. `results_field`::
  35. (Optional, string)
  36. Specifies the field to which the inference prediction is written. Defaults to
  37. `predicted_value`.
  38. [discrete]
  39. [[inference-processor-classification-opt]]
  40. ==== {classification-cap} configuration options
  41. `results_field`::
  42. (Optional, string)
  43. The field that is added to incoming documents to contain the inference prediction. Defaults to
  44. `predicted_value`.
  45. `num_top_classes`::
  46. (Optional, integer)
  47. Specifies the number of top class predictions to return. Defaults to 0.
  48. `top_classes_results_field`::
  49. (Optional, string)
  50. Specifies the field to which the top classes are written. Defaults to
  51. `top_classes`.
  52. [discrete]
  53. [[inference-processor-config-example]]
  54. ==== `inference_config` examples
  55. [source,js]
  56. --------------------------------------------------
  57. {
  58. "inference_config": {
  59. "regression": {
  60. "results_field": "my_regression"
  61. }
  62. }
  63. }
  64. --------------------------------------------------
  65. // NOTCONSOLE
  66. This configuration specifies a `regression` inference and the results are
  67. written to the `my_regression` field contained in the `target_field` results
  68. object.
  69. [source,js]
  70. --------------------------------------------------
  71. {
  72. "inference_config": {
  73. "classification": {
  74. "num_top_classes": 2,
  75. "results_field": "prediction",
  76. "top_classes_results_field": "probabilities"
  77. }
  78. }
  79. }
  80. --------------------------------------------------
  81. // NOTCONSOLE
  82. This configuration specifies a `classification` inference. The number of
  83. categories for which the predicted probabilities are reported is 2
  84. (`num_top_classes`). The result is written to the `prediction` field and the top
  85. classes to the `probabilities` field. Both fields are contained in the
  86. `target_field` results object.