preview-dfanalytics.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[preview-dfanalytics]]
  4. = Preview {dfanalytics} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Preview {dfanalytics}</titleabbrev>
  8. ++++
  9. Previews the features used by a {dataframe-analytics-config}.
  10. beta::[]
  11. [[ml-preview-dfanalytics-request]]
  12. == {api-request-title}
  13. `GET _ml/data_frame/analytics/_preview` +
  14. `POST _ml/data_frame/analytics/_preview` +
  15. `GET _ml/data_frame/analytics/<data_frame_analytics_id>/_preview` +
  16. `POST _ml/data_frame/analytics/<data_frame_analytics_id>/_preview`
  17. [[ml-preview-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-preview-dfanalytics-desc]]
  24. == {api-description-title}
  25. This API provides preview of the extracted features for a {dataframe-analytics-config}
  26. that either exists already or one that has not been created yet.
  27. [[ml-preview-dfanalytics-path-params]]
  28. == {api-path-parms-title}
  29. `<data_frame_analytics_id>`::
  30. (Optional, string)
  31. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics]
  32. [[ml-preview-dfanalytics-request-body]]
  33. == {api-request-body-title}
  34. `config`::
  35. (Optional, object)
  36. A {dataframe-analytics-config} as described in <<put-dfanalytics>>.
  37. Note that `id` and `dest` don't need to be provided in the context of this API.
  38. [role="child_attributes"]
  39. [[ml-preview-dfanalytics-results]]
  40. == {api-response-body-title}
  41. The API returns a response that contains the following:
  42. `feature_values`::
  43. (array)
  44. An array of objects that contain feature name and value pairs. The features have
  45. been processed and indicate what will be sent to the model for training.
  46. [[ml-preview-dfanalytics-example]]
  47. == {api-examples-title}
  48. [source,console]
  49. --------------------------------------------------
  50. POST _ml/data_frame/analytics/_preview
  51. {
  52. "config": {
  53. "source": {
  54. "index": "houses_sold_last_10_yrs"
  55. },
  56. "analysis": {
  57. "regression": {
  58. "dependent_variable": "price"
  59. }
  60. }
  61. }
  62. }
  63. --------------------------------------------------
  64. // TEST[skip:TBD]
  65. The API returns the following results:
  66. [source,console-result]
  67. ----
  68. {
  69. "feature_values": [
  70. {
  71. "number_of_bedrooms": "1",
  72. "postcode": "29655",
  73. "price": "140.4"
  74. },
  75. ...
  76. ]
  77. }
  78. ----