Custom R-monitor example - Performance Monitor for Classification Models
This ModelOp Center monitor computes classification metrics such as Accuracy, Sensitivity, Specificity, and Precision.
Assumptions & Requirements
BUSINESS_MODEL
is a classification model.- Input data must contain:
- 1 column with role=label (ground truth) and dataClass=categorical
- 1 column with role=score (model output) and dataClass=categorical
Execution
metrics
function instantiates R's get_metrics function to calculate a series of Performance metrics using thelabel_column
andscore_column
accordingly.- The test results are appended to a named list such that ModelOp Center can put the metrics in a clean table visually.
Monitor Output
{
"PerformanceMetrics": [
{
".metric": "f_meas",
".estimator": "binary",
".estimate": 0.7344
},
{
".metric": "accuracy",
".estimator": "binary",
".estimate": 0.66
},
{
".metric": "sensitivity",
".estimator": "binary",
".estimate": 0.6528
},
{
".metric": "specificity",
".estimator": "binary",
".estimate": 0.6786
},
{
".metric": "precision",
".estimator": "binary",
".estimate": 0.8393
}
]
}