[DOCS] Adds AUC ROC classification metric to the API examples (#63563) (#63596)

This commit is contained in:
István Zoltán Szabó 2020-10-13 12:18:29 +02:00 committed by GitHub
parent 8499924e51
commit 7139c1d7db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 4 deletions

View File

@ -191,10 +191,10 @@ belongs.
positive. positive.
`class_name`:::: `class_name`::::
(Required, string) Name of the only class that will be treated as (Required, string) Name of the only class that is treated as positive
positive during AUC ROC calculation. Other classes will be treated as during AUC ROC calculation. Other classes are treated as negative
negative ("one-vs-all" strategy). All the evaluated documents must have `class_name` ("one-vs-all" strategy). All the evaluated documents must have
in the list of their top classes. `class_name` in the list of their top classes.
`include_curve`:::: `include_curve`::::
(Optional, boolean) Whether or not the curve should be returned in (Optional, boolean) Whether or not the curve should be returned in
@ -496,3 +496,46 @@ predictions associated with the class.
<5> The number of cats in the dataset that are incorrectly classified as dogs. <5> The number of cats in the dataset that are incorrectly classified as dogs.
<6> The number of documents that are classified as a class that is not listed as <6> The number of documents that are classified as a class that is not listed as
a `predicted_class`. a `predicted_class`.
[source,console]
--------------------------------------------------
POST _ml/data_frame/_evaluate
{
"index": "animal_classification",
"evaluation": {
"classification": { <1>
"actual_field": "animal_class", <2>
"metrics": {
"auc_roc" : { <3>
"class_name": "dog" <4>
}
}
}
}
}
--------------------------------------------------
// TEST[skip:TBD]
<1> The evaluation type.
<2> The field that contains the ground truth value for the actual animal
classification. This is required in order to evaluate results.
<3> Specifies the metric for the evaluation.
<4> Specifies the class name that is treated as positive during the evaluation,
all the other classes are treated as negative.
The API returns the following result:
[source,console-result]
--------------------------------------------------
{
"classification" : {
"auc_roc" : {
"score" : 0.8941788639536681
}
}
}
--------------------------------------------------
// TEST[skip:TBD]