explain-dfanalytics.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 privileges:
  20. * cluster: `monitor_ml`
  21. For more information, see <<security-privileges>> and <<built-in-roles>>.
  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. about either an existing {dfanalytics-job} or one that has not been created yet.
  31. [[ml-explain-dfanalytics-path-params]]
  32. ==== {api-path-parms-title}
  33. `<data_frame_analytics_id>`::
  34. (Optional, string)
  35. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics]
  36. [[ml-explain-dfanalytics-request-body]]
  37. ==== {api-request-body-title}
  38. `data_frame_analytics_config`::
  39. (Optional, object) Intended configuration of {dfanalytics-job}. Note that `id`
  40. and `dest` don't need to be provided in the context of this API.
  41. [[ml-explain-dfanalytics-results]]
  42. ==== {api-response-body-title}
  43. The API returns a response that contains the following:
  44. `field_selection`::
  45. (array)
  46. include::{docdir}/ml/ml-shared.asciidoc[tag=field-selection]
  47. `memory_estimation`::
  48. (object)
  49. include::{docdir}/ml/ml-shared.asciidoc[tag=memory-estimation]
  50. [[ml-explain-dfanalytics-example]]
  51. ==== {api-examples-title}
  52. [source,console]
  53. --------------------------------------------------
  54. POST _ml/data_frame/analytics/_explain
  55. {
  56. "data_frame_analytics_config": {
  57. "source": {
  58. "index": "houses_sold_last_10_yrs"
  59. },
  60. "analysis": {
  61. "regression": {
  62. "dependent_variable": "price"
  63. }
  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. ----