explain-dfanalytics.asciidoc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. If the {es} {security-features} are enabled, you must have the following
  20. privileges:
  21. * cluster: `monitor_ml`
  22. For more information, see <<security-privileges>> and {ml-docs-setup-privileges}.
  23. [[ml-explain-dfanalytics-desc]]
  24. == {api-description-title}
  25. This API provides explanations for a {dataframe-analytics-config} that either
  26. exists already or one that has not been created yet.
  27. The following explanations are provided:
  28. * which fields are included or not in the analysis and why,
  29. * how much memory is estimated to be required. The estimate can be used when
  30. deciding the appropriate value for `model_memory_limit` setting later on.
  31. If you have object fields or fields that are excluded via source filtering,
  32. they are not included in the explanation.
  33. [[ml-explain-dfanalytics-path-params]]
  34. == {api-path-parms-title}
  35. `<data_frame_analytics_id>`::
  36. (Optional, string)
  37. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics]
  38. [[ml-explain-dfanalytics-request-body]]
  39. == {api-request-body-title}
  40. A {dataframe-analytics-config} as described in <<put-dfanalytics>>.
  41. Note that `id` and `dest` don't need to be provided in the context of this API.
  42. [role="child_attributes"]
  43. [[ml-explain-dfanalytics-results]]
  44. == {api-response-body-title}
  45. The API returns a response that contains the following:
  46. `field_selection`::
  47. (array)
  48. An array of objects that explain selection for each field, sorted by
  49. the field names.
  50. +
  51. .Properties of `field_selection` objects
  52. [%collapsible%open]
  53. ====
  54. `is_included`:::
  55. (boolean) Whether the field is selected to be included in the analysis.
  56. `is_required`:::
  57. (boolean) Whether the field is required.
  58. `feature_type`:::
  59. (string) The feature type of this field for the analysis. May be `categorical`
  60. or `numerical`.
  61. `mapping_types`:::
  62. (string) The mapping types of the field.
  63. `name`:::
  64. (string) The field name.
  65. `reason`:::
  66. (string) The reason a field is not selected to be included in the analysis.
  67. ====
  68. `memory_estimation`::
  69. (object)
  70. An object containing the memory estimates.
  71. +
  72. .Properties of `memory_estimation`
  73. [%collapsible%open]
  74. ====
  75. `expected_memory_with_disk`:::
  76. (string) Estimated memory usage under the assumption that overflowing to disk is
  77. allowed during {dfanalytics}. `expected_memory_with_disk` is usually smaller
  78. than `expected_memory_without_disk` as using disk allows to limit the main
  79. memory needed to perform {dfanalytics}.
  80. `expected_memory_without_disk`:::
  81. (string) Estimated memory usage under the assumption that the whole
  82. {dfanalytics} should happen in memory (i.e. without overflowing to disk).
  83. ====
  84. [[ml-explain-dfanalytics-example]]
  85. == {api-examples-title}
  86. [source,console]
  87. --------------------------------------------------
  88. POST _ml/data_frame/analytics/_explain
  89. {
  90. "source": {
  91. "index": "houses_sold_last_10_yrs"
  92. },
  93. "analysis": {
  94. "regression": {
  95. "dependent_variable": "price"
  96. }
  97. }
  98. }
  99. --------------------------------------------------
  100. // TEST[skip:TBD]
  101. The API returns the following results:
  102. [source,console-result]
  103. ----
  104. {
  105. "field_selection": [
  106. {
  107. "field": "number_of_bedrooms",
  108. "mappings_types": ["integer"],
  109. "is_included": true,
  110. "is_required": false,
  111. "feature_type": "numerical"
  112. },
  113. {
  114. "field": "postcode",
  115. "mappings_types": ["text"],
  116. "is_included": false,
  117. "is_required": false,
  118. "reason": "[postcode.keyword] is preferred because it is aggregatable"
  119. },
  120. {
  121. "field": "postcode.keyword",
  122. "mappings_types": ["keyword"],
  123. "is_included": true,
  124. "is_required": false,
  125. "feature_type": "categorical"
  126. },
  127. {
  128. "field": "price",
  129. "mappings_types": ["float"],
  130. "is_included": true,
  131. "is_required": true,
  132. "feature_type": "numerical"
  133. }
  134. ],
  135. "memory_estimation": {
  136. "expected_memory_without_disk": "128MB",
  137. "expected_memory_with_disk": "32MB"
  138. }
  139. }
  140. ----