Calculate Binary Confusion Matrix
Calculates the confusion matrix for a binary classification problem once and then calculates all confusion measures of this package.
confusion_matrix(truth, response, positive, na_value = NaN, relative = FALSE)
truth |
( |
response |
( |
positive |
( |
na_value |
( |
relative |
( |
List with two elements:
matrix stores the calculated confusion matrix.
measures stores the metrics as named numeric vector.
set.seed(123)
lvls = c("a", "b")
truth = factor(sample(lvls, 20, replace = TRUE), levels = lvls)
response = factor(sample(lvls, 20, replace = TRUE), levels = lvls)
confusion_matrix(truth, response, positive = "a")
confusion_matrix(truth, response, positive = "a", relative = TRUE)
confusion_matrix(truth, response, positive = "b")Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.