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 R or in C#; threshold your own series into 0/1 labels
before calling this.
Usage
classification_metrics(observed, modeled)
Arguments
- observed, modeled
numeric vectors of equal length holding binary (0/1) labels.
Value
a named numeric vector of accuracy, precision, recall, f1, specificity, and
balanced_accuracy.
Examples
obs <- c(1, 0, 1, 1, 0)
mod <- c(1, 0, 0, 1, 0)
classification_metrics(obs, mod)
#> accuracy precision recall f1
#> 80.0000000 1.0000000 0.6666667 0.8000000
#> specificity balanced_accuracy
#> 1.0000000 0.8333333