preview-dfanalytics.asciidoc 2.2 KB

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