specificity | R Documentation |
Calculates Specificity, also known as the True Negative Rate (TNR), which is the proportion of actual negatives that are correctly identified as such by the classifier. Specificity is a key measure in evaluating the effectiveness of a classifier in identifying negative instances.
dx_specificity(cm, detail = "full", ...)
dx_tnr(cm, detail = "full", ...)
cm |
A dx_cm object created by |
detail |
Character specifying the level of detail in the output: "simple" for raw estimate, "full" for detailed estimate including 95% confidence intervals. |
... |
Additional arguments to pass to metric_binomial function, such as
|
Specificity or TNR measures how well the classifier can identify negative instances, which is critical in situations where false positives carry a high cost. A higher specificity indicates a better performance in recognizing negative instances and avoiding false alarms.
The formula for Specificity is:
Specificity = \frac{True Negatives}{True Negatives + False Positives}
Depending on the detail
parameter, returns a numeric value
representing the calculated metric or a data frame/tibble with
detailed diagnostics including confidence intervals and possibly other
metrics relevant to understanding the metric.
dx_cm()
to understand how to create and interact with a
'dx_cm' object.
cm <- dx_cm(dx_heart_failure$predicted, dx_heart_failure$truth,
threshold =
0.5, poslabel = 1
)
simple_specificity <- dx_specificity(cm, detail = "simple")
detailed_specificity <- dx_specificity(cm)
print(simple_specificity)
print(detailed_specificity)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.