Classification Metrics
Usage
classification_metrics(
true_labels,
predicted_labels,
predicted_prob = NULL,
binclasspos = 2L,
calc_auc = TRUE,
calc_brier = TRUE,
auc_method = "lightAUC",
sample = character(),
verbosity = 0L
)
Arguments
- true_labels
Factor: True labels.
- predicted_labels
Factor: predicted values.
- predicted_prob
Numeric vector: predicted probabilities.
- binclasspos
Integer: Factor level position of the positive class in binary classification.
- calc_auc
Logical: If TRUE, calculate AUC. May be slow in very large datasets.
- calc_brier
Logical: If TRUE, calculate Brier_Score.
- auc_method
Character: "lightAUC", "pROC", "ROCR".
- sample
Character: Sample name.
- verbosity
Integer: Verbosity level.
Details
Note that auc_method = "pROC" is the only one that will output an AUC even if one or more predicted probabilities are NA.
Examples
if (FALSE) { # \dontrun{
# Assume positive class is "b"
true_labels <- factor(c("a", "a", "a", "b", "b", "b", "b", "b", "b", "b"))
predicted_labels <- factor(c("a", "b", "a", "b", "b", "a", "b", "b", "b", "a"))
predicted_prob <- c(0.3, 0.55, 0.45, 0.75, 0.57, 0.3, 0.8, 0.63, 0.62, 0.39)
classification_metrics(true_labels, predicted_labels, predicted_prob)
classification_metrics(true_labels, predicted_labels, 1 - predicted_prob, binclasspos = 1L)
} # }