explain-dfanalytics.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 <<built-in-roles>>.
  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::{docdir}/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. include::{docdir}/ml/ml-shared.asciidoc[tag=field-selection]
  49. `memory_estimation`::
  50. (object)
  51. include::{docdir}/ml/ml-shared.asciidoc[tag=memory-estimation]
  52. [[ml-explain-dfanalytics-example]]
  53. ==== {api-examples-title}
  54. [source,console]
  55. --------------------------------------------------
  56. POST _ml/data_frame/analytics/_explain
  57. {
  58. "source": {
  59. "index": "houses_sold_last_10_yrs"
  60. },
  61. "analysis": {
  62. "regression": {
  63. "dependent_variable": "price"
  64. }
  65. }
  66. }
  67. --------------------------------------------------
  68. // TEST[skip:TBD]
  69. The API returns the following results:
  70. [source,console-result]
  71. ----
  72. {
  73. "field_selection": [
  74. {
  75. "field": "number_of_bedrooms",
  76. "mappings_types": ["integer"],
  77. "is_included": true,
  78. "is_required": false,
  79. "feature_type": "numerical"
  80. },
  81. {
  82. "field": "postcode",
  83. "mappings_types": ["text"],
  84. "is_included": false,
  85. "is_required": false,
  86. "reason": "[postcode.keyword] is preferred because it is aggregatable"
  87. },
  88. {
  89. "field": "postcode.keyword",
  90. "mappings_types": ["keyword"],
  91. "is_included": true,
  92. "is_required": false,
  93. "feature_type": "categorical"
  94. },
  95. {
  96. "field": "price",
  97. "mappings_types": ["float"],
  98. "is_included": true,
  99. "is_required": true,
  100. "feature_type": "numerical"
  101. }
  102. ],
  103. "memory_estimation": {
  104. "expected_memory_without_disk": "128MB",
  105. "expected_memory_with_disk": "32MB"
  106. }
  107. }
  108. ----