preview-dfanalytics.asciidoc 2.3 KB

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