Evaluate data frame analytics Added in 7.3.0
The API packages together commonly used evaluation metrics for various types of machine learning features. This has been designed for use on indexes created by data frame analytics. Evaluation requires both a ground truth field and an analytics result field to be present.
POST /_ml/data_frame/_evaluate
curl \
-X POST http://api.example.com/_ml/data_frame/_evaluate \
-H "Content-Type: application/json" \
-d '{"evaluation":{"classification":{"actual_field":"string","predicted_field":"string","top_classes_field":"string","":{"auc_roc":{"class_name":"string","include_curve":true},"precision":{"additionalProperty1":{},"additionalProperty2":{}},"recall":{"additionalProperty1":{},"additionalProperty2":{}},"accuracy":{"additionalProperty1":{},"additionalProperty2":{}},"multiclass_confusion_matrix":{"additionalProperty1":{},"additionalProperty2":{}}}},"outlier_detection":{"actual_field":"string","predicted_probability_field":"string","":{"auc_roc":{"class_name":"string","include_curve":true},"precision":{"additionalProperty1":{},"additionalProperty2":{}},"recall":{"additionalProperty1":{},"additionalProperty2":{}},"confusion_matrix":{"additionalProperty1":{},"additionalProperty2":{}}}},"regression":{"actual_field":"string","predicted_field":"string","metrics":{"mse":{"additionalProperty1":{},"additionalProperty2":{}},"msle":{"offset":42.0},"huber":{"delta":42.0},"r_squared":{"additionalProperty1":{},"additionalProperty2":{}}}}},"index":"string","query":{}}'
Request examples
{
"evaluation": {
"classification": {
"actual_field": "string",
"predicted_field": "string",
"top_classes_field": "string",
"": {
"auc_roc": {
"class_name": "string",
"include_curve": true
},
"precision": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"recall": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"accuracy": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"multiclass_confusion_matrix": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
},
"outlier_detection": {
"actual_field": "string",
"predicted_probability_field": "string",
"": {
"auc_roc": {
"class_name": "string",
"include_curve": true
},
"precision": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"recall": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"confusion_matrix": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
},
"regression": {
"actual_field": "string",
"predicted_field": "string",
"metrics": {
"mse": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"msle": {
"offset": 42.0
},
"huber": {
"delta": 42.0
},
"r_squared": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
}
},
"index": "string",
"query": {}
}
Response examples (200)
{
"classification": {
"": {
"value": 42.0,
"curve": [
{
"tpr": 42.0,
"fpr": 42.0,
"threshold": 42.0
}
]
},
"accuracy": {
"classes": [
{
"value": 42.0,
"class_name": "string"
}
],
"overall_accuracy": 42.0
},
"multiclass_confusion_matrix": {
"confusion_matrix": [
{
"actual_class": "string",
"actual_class_doc_count": 42.0,
"predicted_classes": [
{}
],
"other_predicted_class_doc_count": 42.0
}
],
"other_actual_class_count": 42.0
},
"precision": {
"classes": [
{
"value": 42.0,
"class_name": "string"
}
],
"avg_precision": 42.0
},
"recall": {
"classes": [
{
"value": 42.0,
"class_name": "string"
}
],
"avg_recall": 42.0
}
},
"outlier_detection": {
"": {
"value": 42.0,
"curve": [
{
"tpr": 42.0,
"fpr": 42.0,
"threshold": 42.0
}
]
},
"precision": {
"additionalProperty1": 42.0,
"additionalProperty2": 42.0
},
"recall": {
"additionalProperty1": 42.0,
"additionalProperty2": 42.0
},
"confusion_matrix": {
"additionalProperty1": {
"tp": 42.0,
"fp": 42.0,
"tn": 42.0,
"fn": 42.0
},
"additionalProperty2": {
"tp": 42.0,
"fp": 42.0,
"tn": 42.0,
"fn": 42.0
}
}
},
"regression": {
"huber": {
"value": 42.0
},
"mse": {
"value": 42.0
},
"msle": {
"value": 42.0
},
"r_squared": {
"value": 42.0
}
}
}