evaluate-data-frame.asciidoc 5.7 KB

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