explain-dfanalytics.asciidoc 4.3 KB

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