Skip to content

Commit 675a659

Browse files
committed
Add yml test for using AucRoc with the old results format
1 parent cd1a27f commit 675a659

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

x-pack/plugin/ml/qa/ml-with-security/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ yamlRestTest {
119119
'ml/evaluate_data_frame/Test classification auc_roc given actual_field is never equal to fish',
120120
'ml/evaluate_data_frame/Test classification auc_roc given predicted_class_field is never equal to mouse',
121121
'ml/evaluate_data_frame/Test classification auc_roc with missing class_name',
122+
'ml/evaluate_data_frame/Test classification auc_roc with old results format',
122123
'ml/evaluate_data_frame/Test classification accuracy with missing predicted_field',
123124
'ml/evaluate_data_frame/Test regression given evaluation with empty metrics',
124125
'ml/evaluate_data_frame/Test regression given missing actual_field',

x-pack/plugin/ml/qa/ml-with-security/roles.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ minimal:
77
# Give all users involved in these tests access to the indices where the data to
88
# be analyzed is stored, because the ML roles alone do not provide access to
99
# non-ML indices
10-
- names: [ 'airline-data', 'index-*', 'unavailable-data', 'utopia', 'store' ]
10+
- names: [ 'airline-data', 'index-*', 'unavailable-data', 'utopia*', 'store' ]
1111
privileges:
1212
- create_index
1313
- indices:admin/refresh

x-pack/plugin/src/test/resources/rest-api-spec/test/ml/evaluate_data_frame.yml

+36
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,23 @@ setup:
186186
"foo": 0.24
187187
}
188188
189+
- do:
190+
indices.create:
191+
index: utopia_old_results_format
192+
193+
# This document is indexed to utopia_old_results_format index *without* nested mapping for ml.top_classes field
194+
- do:
195+
index:
196+
index: utopia_old_results_format
197+
body: >
198+
{
199+
"classification_field_act": "cat",
200+
"ml.top_classes": [
201+
{"class_name": "dog", "class_probability": 0.9},
202+
{"class_name": "cat", "class_probability": 0.1}
203+
]
204+
}
205+
189206
- do:
190207
indices.refresh: {}
191208

@@ -750,6 +767,25 @@ setup:
750767
- match: { classification.auc_roc.doc_count: 8 }
751768
- is_false: classification.auc_roc.curve
752769
---
770+
"Test classification auc_roc with old results format":
771+
- do:
772+
catch: /\[nested\] nested object under path \[ml.top_classes\] is not of nested type/
773+
ml.evaluate_data_frame:
774+
body: >
775+
{
776+
"index": "utopia_old_results_format",
777+
"evaluation": {
778+
"classification": {
779+
"actual_field": "classification_field_act.keyword",
780+
"metrics": {
781+
"auc_roc": {
782+
"class_name": "cat"
783+
}
784+
}
785+
}
786+
}
787+
}
788+
---
753789
"Test classification accuracy with missing predicted_field":
754790
- do:
755791
catch: /\[classification\] must define \[predicted_field\] as required by the following metrics \[accuracy\]/

0 commit comments

Comments
 (0)