classification_metrics
classification_metrics(observed, modeled)Classification metrics for two binary label vectors.
Mirrors the C# GoodnessOfFit classification statics (Accuracy/Precision/ Recall/F1Score/Specificity/BalancedAccuracy): both observed and modeled are already-binary label vectors, compared elementwise – a value equal to its counterpart counts as a match. There is no threshold argument, in Python or in C#; threshold your own series into 0/1 labels before calling this.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| observed | array_like | Numeric vectors of equal length holding binary (0/1) labels. | required |
| modeled | array_like | Numeric vectors of equal length holding binary (0/1) labels. | required |
Returns
| Name | Type | Description |
|---|---|---|
| dict | Keys accuracy, precision, recall, f1, specificity, balanced_accuracy. |
Examples
>>> from corehydropy import classification_metrics
>>> classification_metrics([1, 0, 1, 1, 0], [1, 0, 0, 1, 0])["accuracy"]
80.0