specificity | R Documentation |
Given the observed and predicted values of categorical data (of any number of classes) computes the specificity, the metric that evaluates a model's ability to predict true negatives of each available category.
specificity(observed, predicted, positive_class = NULL, remove_na = TRUE)
observed |
( |
predicted |
( |
positive_class |
( |
remove_na |
( |
Given the following binary confusion matrix:
Specificity is computed as:
For binary data a single value is returned, for more than 2 categories a vector of sensitivities is returned, one per each category.
Other categorical_metrics:
accuracy()
,
brier_score()
,
categorical_summary()
,
confusion_matrix()
,
f1_score()
,
kappa_coeff()
,
math_mode()
,
matthews_coeff()
,
pccc()
,
pcic()
,
pr_auc()
,
precision()
,
recall()
,
roc_auc()
,
sensitivity()
## Not run:
specificity(factor(c("a", "b")), factor(c("a", "b")))
specificity(factor(c("a", "b")), factor(c("b", "a")))
specificity(factor(c("a", "b")), factor(c("b", "b")))
specificity(factor(c(TRUE, FALSE)), factor(c(FALSE, TRUE)))
specificity(factor(c("a", "b", "a")), factor(c("b", "a", "c")))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.