1
0

explain-dfanalytics.asciidoc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[explain-dfanalytics]]
  4. === Explain {dfanalytics} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Explain {dfanalytics} API</titleabbrev>
  8. ++++
  9. Explains a {dataframe-analytics-config}.
  10. experimental[]
  11. [[ml-explain-dfanalytics-request]]
  12. ==== {api-request-title}
  13. `GET _ml/data_frame/analytics/_explain` +
  14. `POST _ml/data_frame/analytics/_explain` +
  15. `GET _ml/data_frame/analytics/<data_frame_analytics_id>/_explain` +
  16. `POST _ml/data_frame/analytics/<data_frame_analytics_id>/_explain`
  17. [[ml-explain-dfanalytics-prereq]]
  18. ==== {api-prereq-title}
  19. * You must have `monitor_ml` privilege to use this API. For more
  20. information, see <<security-privileges>> and <<built-in-roles>>.
  21. [[ml-explain-dfanalytics-desc]]
  22. ==== {api-description-title}
  23. This API provides explanations for a {dataframe-analytics-config} that either exists already or one that has not been created yet.
  24. The following explanations are provided:
  25. * which fields are included or not in the analysis and why
  26. * how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for `model_memory_limit` setting later on.
  27. about either an existing {dfanalytics-job} or one that has not been created yet.
  28. [[ml-explain-dfanalytics-path-params]]
  29. ==== {api-path-parms-title}
  30. `<data_frame_analytics_id>`::
  31. (Optional, string)
  32. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics]
  33. [[ml-explain-dfanalytics-request-body]]
  34. ==== {api-request-body-title}
  35. `data_frame_analytics_config`::
  36. (Optional, object) Intended configuration of {dfanalytics-job}. For more information, see
  37. <<ml-dfanalytics-resources>>.
  38. Note that `id` and `dest` don't need to be provided in the context of this API.
  39. [[ml-explain-dfanalytics-results]]
  40. ==== {api-response-body-title}
  41. The API returns a response that contains the following:
  42. `field_selection`::
  43. (array) An array of objects that explain selection for each field, sorted by the field names.
  44. Each object in the array has the following properties:
  45. `name`:::
  46. (string) The field name.
  47. `mapping_types`:::
  48. (string) The mapping types of the field.
  49. `is_included`:::
  50. (boolean) Whether the field is selected to be included in the analysis.
  51. `is_required`:::
  52. (boolean) Whether the field is required.
  53. `feature_type`:::
  54. (string) The feature type of this field for the analysis. May be `categorical` or `numerical`.
  55. `reason`:::
  56. (string) The reason a field is not selected to be included in the analysis.
  57. `memory_estimation`::
  58. (object) An object containing the memory estimates. The object has the following properties:
  59. `expected_memory_without_disk`:::
  60. (string) Estimated memory usage under the assumption that the whole {dfanalytics} should happen in memory
  61. (i.e. without overflowing to disk).
  62. `expected_memory_with_disk`:::
  63. (string) Estimated memory usage under the assumption that overflowing to disk is allowed during {dfanalytics}.
  64. `expected_memory_with_disk` is usually smaller than `expected_memory_without_disk` as using disk allows to
  65. limit the main memory needed to perform {dfanalytics}.
  66. [[ml-explain-dfanalytics-example]]
  67. ==== {api-examples-title}
  68. [source,console]
  69. --------------------------------------------------
  70. POST _ml/data_frame/analytics/_explain
  71. {
  72. "data_frame_analytics_config": {
  73. "source": {
  74. "index": "houses_sold_last_10_yrs"
  75. },
  76. "analysis": {
  77. "regression": {
  78. "dependent_variable": "price"
  79. }
  80. }
  81. }
  82. }
  83. --------------------------------------------------
  84. // TEST[skip:TBD]
  85. The API returns the following results:
  86. [source,console-result]
  87. ----
  88. {
  89. "field_selection": [
  90. {
  91. "field": "number_of_bedrooms",
  92. "mappings_types": ["integer"],
  93. "is_included": true,
  94. "is_required": false,
  95. "feature_type": "numerical"
  96. },
  97. {
  98. "field": "postcode",
  99. "mappings_types": ["text"],
  100. "is_included": false,
  101. "is_required": false,
  102. "reason": "[postcode.keyword] is preferred because it is aggregatable"
  103. },
  104. {
  105. "field": "postcode.keyword",
  106. "mappings_types": ["keyword"],
  107. "is_included": true,
  108. "is_required": false,
  109. "feature_type": "categorical"
  110. },
  111. {
  112. "field": "price",
  113. "mappings_types": ["float"],
  114. "is_included": true,
  115. "is_required": true,
  116. "feature_type": "numerical"
  117. }
  118. ],
  119. "memory_estimation": {
  120. "expected_memory_without_disk": "128MB",
  121. "expected_memory_with_disk": "32MB"
  122. }
  123. }
  124. ----