# Sensitivity vs. specificity vs. recall

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:

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:

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

• 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/… Nov 1, 2022 at 19:25
• Good observation. Agree with Henry. I use the Wikipedia forms. (This shows another example of poor proofing of equations in a maths/stats book) Nov 2, 2022 at 4:53

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.

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.