evaluate-data-frame.asciidoc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. --
  2. :api: evaluate-data-frame
  3. :request: EvaluateDataFrameRequest
  4. :response: EvaluateDataFrameResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Evaluate {dfanalytics} API
  9. Evaluates the {dfanalytics} for an annotated index.
  10. The API accepts an +{request}+ object and returns an +{response}+.
  11. [id="{upid}-{api}-request"]
  12. ==== Evaluate {dfanalytics} request
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests-file}[{api}-request]
  16. --------------------------------------------------
  17. <1> Constructing a new evaluation request
  18. <2> Reference to an existing index
  19. <3> The query with which to select data from indices
  20. <4> Evaluation to be performed
  21. ==== Evaluation
  22. Evaluation to be performed.
  23. Currently, supported evaluations include: +OutlierDetection+, +Classification+, +Regression+.
  24. ===== Outlier detection
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests-file}[{api}-evaluation-outlierdetection]
  28. --------------------------------------------------
  29. <1> Constructing a new evaluation
  30. <2> Name of the field in the index. Its value denotes the actual (i.e. ground truth) label for an example. Must be either true or false.
  31. <3> Name of the field in the index. Its value denotes the probability (as per some ML algorithm) of the example being classified as positive.
  32. <4> The remaining parameters are the metrics to be calculated based on the two fields described above
  33. <5> {wikipedia}/Precision_and_recall#Precision[Precision] calculated at thresholds: 0.4, 0.5 and 0.6
  34. <6> {wikipedia}/Precision_and_recall#Recall[Recall] calculated at thresholds: 0.5 and 0.7
  35. <7> {wikipedia}/Confusion_matrix[Confusion matrix] calculated at threshold 0.5
  36. <8> {wikipedia}/Receiver_operating_characteristic#Area_under_the_curve[AuC ROC] calculated and the curve points returned
  37. ===== Classification
  38. ["source","java",subs="attributes,callouts,macros"]
  39. --------------------------------------------------
  40. include-tagged::{doc-tests-file}[{api}-evaluation-classification]
  41. --------------------------------------------------
  42. <1> Constructing a new evaluation
  43. <2> Name of the field in the index. Its value denotes the actual (i.e. ground truth) class the example belongs to.
  44. <3> Name of the field in the index. Its value denotes the predicted (as per some ML algorithm) class of the example.
  45. <4> Name of the field in the index. Its value denotes the array of top classes. Must be nested.
  46. <5> The remaining parameters are the metrics to be calculated based on the two fields described above
  47. <6> Accuracy
  48. <7> Precision
  49. <8> Recall
  50. <9> Multiclass confusion matrix of size 3
  51. <10> {wikipedia}/Receiver_operating_characteristic#Area_under_the_curve[AuC ROC] calculated for class "cat" treated as positive and the rest as negative
  52. ===== Regression
  53. ["source","java",subs="attributes,callouts,macros"]
  54. --------------------------------------------------
  55. include-tagged::{doc-tests-file}[{api}-evaluation-regression]
  56. --------------------------------------------------
  57. <1> Constructing a new evaluation
  58. <2> Name of the field in the index. Its value denotes the actual (i.e. ground truth) value for an example.
  59. <3> Name of the field in the index. Its value denotes the predicted (as per some ML algorithm) value for the example.
  60. <4> The remaining parameters are the metrics to be calculated based on the two fields described above
  61. <5> {wikipedia}/Mean_squared_error[Mean squared error]
  62. <6> Mean squared logarithmic error
  63. <7> {wikipedia}/Huber_loss#Pseudo-Huber_loss_function[Pseudo Huber loss]
  64. <8> {wikipedia}/Coefficient_of_determination[R squared]
  65. include::../execution.asciidoc[]
  66. [id="{upid}-{api}-response"]
  67. ==== Response
  68. The returned +{response}+ contains the requested evaluation metrics.
  69. ["source","java",subs="attributes,callouts,macros"]
  70. --------------------------------------------------
  71. include-tagged::{doc-tests-file}[{api}-response]
  72. --------------------------------------------------
  73. <1> Fetching all the calculated metrics results
  74. ==== Results
  75. ===== Outlier detection
  76. ["source","java",subs="attributes,callouts,macros"]
  77. --------------------------------------------------
  78. include-tagged::{doc-tests-file}[{api}-results-outlierdetection]
  79. --------------------------------------------------
  80. <1> Fetching precision metric by name
  81. <2> Fetching precision at a given (0.4) threshold
  82. <3> Fetching confusion matrix metric by name
  83. <4> Fetching confusion matrix at a given (0.5) threshold
  84. ===== Classification
  85. ["source","java",subs="attributes,callouts,macros"]
  86. --------------------------------------------------
  87. include-tagged::{doc-tests-file}[{api}-results-classification]
  88. --------------------------------------------------
  89. <1> Fetching accuracy metric by name
  90. <2> Fetching the actual accuracy value
  91. <3> Fetching precision metric by name
  92. <4> Fetching the actual precision value
  93. <5> Fetching recall metric by name
  94. <6> Fetching the actual recall value
  95. <7> Fetching multiclass confusion matrix metric by name
  96. <8> Fetching the contents of the confusion matrix
  97. <9> Fetching the number of classes that were not included in the matrix
  98. <10> Fetching AucRoc metric by name
  99. <11> Fetching the actual AucRoc score
  100. ===== Regression
  101. ["source","java",subs="attributes,callouts,macros"]
  102. --------------------------------------------------
  103. include-tagged::{doc-tests-file}[{api}-results-regression]
  104. --------------------------------------------------
  105. <1> Fetching mean squared error metric by name
  106. <2> Fetching the actual mean squared error value
  107. <3> Fetching mean squared logarithmic error metric by name
  108. <4> Fetching the actual mean squared logarithmic error value
  109. <5> Fetching pseudo Huber loss metric by name
  110. <6> Fetching the actual pseudo Huber loss value
  111. <7> Fetching R squared metric by name
  112. <8> Fetching the actual R squared value