explain-dfanalytics.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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
  24. exists already or one that has not been created yet.
  25. The following explanations are provided:
  26. * which fields are included or not in the analysis and why,
  27. * how much memory is estimated to be required. The estimate can be used when
  28. deciding the appropriate value for `model_memory_limit` setting later on,
  29. about either an existing {dfanalytics-job} or one that has not been created yet.
  30. [[ml-explain-dfanalytics-path-params]]
  31. ==== {api-path-parms-title}
  32. `<data_frame_analytics_id>`::
  33. (Optional, string)
  34. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics]
  35. [[ml-explain-dfanalytics-request-body]]
  36. ==== {api-request-body-title}
  37. `data_frame_analytics_config`::
  38. (Optional, object) Intended configuration of {dfanalytics-job}. Note that `id`
  39. and `dest` don't need to be provided in the context of this API.
  40. [[ml-explain-dfanalytics-results]]
  41. ==== {api-response-body-title}
  42. The API returns a response that contains the following:
  43. `field_selection`::
  44. (array)
  45. include::{docdir}/ml/ml-shared.asciidoc[tag=field-selection]
  46. `memory_estimation`::
  47. (object)
  48. include::{docdir}/ml/ml-shared.asciidoc[tag=memory-estimation]
  49. [[ml-explain-dfanalytics-example]]
  50. ==== {api-examples-title}
  51. [source,console]
  52. --------------------------------------------------
  53. POST _ml/data_frame/analytics/_explain
  54. {
  55. "data_frame_analytics_config": {
  56. "source": {
  57. "index": "houses_sold_last_10_yrs"
  58. },
  59. "analysis": {
  60. "regression": {
  61. "dependent_variable": "price"
  62. }
  63. }
  64. }
  65. }
  66. --------------------------------------------------
  67. // TEST[skip:TBD]
  68. The API returns the following results:
  69. [source,console-result]
  70. ----
  71. {
  72. "field_selection": [
  73. {
  74. "field": "number_of_bedrooms",
  75. "mappings_types": ["integer"],
  76. "is_included": true,
  77. "is_required": false,
  78. "feature_type": "numerical"
  79. },
  80. {
  81. "field": "postcode",
  82. "mappings_types": ["text"],
  83. "is_included": false,
  84. "is_required": false,
  85. "reason": "[postcode.keyword] is preferred because it is aggregatable"
  86. },
  87. {
  88. "field": "postcode.keyword",
  89. "mappings_types": ["keyword"],
  90. "is_included": true,
  91. "is_required": false,
  92. "feature_type": "categorical"
  93. },
  94. {
  95. "field": "price",
  96. "mappings_types": ["float"],
  97. "is_included": true,
  98. "is_required": true,
  99. "feature_type": "numerical"
  100. }
  101. ],
  102. "memory_estimation": {
  103. "expected_memory_without_disk": "128MB",
  104. "expected_memory_with_disk": "32MB"
  105. }
  106. }
  107. ----