2
$\begingroup$

Given a binary confusion matrix with true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN), what are the formulas for sensitivity, specificity, and recall?

I'm coming across many conflicting answers online. For instance, wikipedia says:

enter image description here

But in a textbook — "Data Science for Business: What You Need to Know about Data Mining and Data-Analytic Thinking" (Provost & Fawcett, 2013) — it says:

enter image description here

Which one is correct? Is there an authoritative reference on this?

$\endgroup$
2
  • 3
    $\begingroup$ The Wikipedia definitions are those commonly used for sensitivity and specificity. See for example how they are defined by Cochrane (international best practice in medical research) uk.cochrane.org/news/… $\endgroup$
    – Henry
    Nov 1, 2022 at 19:25
  • 1
    $\begingroup$ Good observation. Agree with Henry. I use the Wikipedia forms. (This shows another example of poor proofing of equations in a maths/stats book) $\endgroup$
    – Mari153
    Nov 2, 2022 at 4:53

2 Answers 2

2
$\begingroup$

The sensitivity of the model is the rate at the class of interest is predicted correctly for all samples having the class. Wikipedia is correct. To quote the Elements of Statistical Learning by Friedman et al. "Sensitivity: probability of predicting disease given true state is disease." the book has a nice worked example in Ch. 9. Similarlly in Probabilistic Machine Learning: An Introduction by Kevin Patrick Murphy: "we can compute the true positive rate (TPR), also known as the sensitivity, recall or hit rate, by using (...)". Both books are well-accepted as authoritative references in ML. The "Data Science for Business" book had some copywriting and/or proofreading error on this.

$\endgroup$
0
$\begingroup$

Both precision and specificity are related to false positives/type 1 error ($FDR$ denotes false discovery rate, $FPR$ denotes false positive rate).

$$\text{precision}=1-FDR=1-\frac{FP}{\hat{P}}=1-\frac{FP}{TP+FP}$$

$$\text{specificity}=1-FPR=1-\frac{FP}{N}=1-\frac{FP}{TN+FP}$$

Recall or Sensitivity are the same thing, and relate to false negatives/type 2 error ($FNR$ denotes false negative rate).

$$\text{recall}=\text{sensitivity}=1-FNR=1-\frac{FN}{P}=1-\frac{FN}{TP+FN}$$

Don't worry, I always have to look it up myself too. Get used to the table on Wikipedia.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.