Understanding Sensitivity, Specificity, Precision, Recall, F1 Score, and Confusion Matrix in Binary Classification
Introduction:
In the world of binary classification, where outcomes are often reduced to simple True or False, understanding the nuances of Sensitivity, Specificity, Precision, Recall, F1 Score, and the Confusion Matrix can be the key to unlocking the true performance of your models. Whether you’re deciphering medical test results or evaluating machine learning algorithms, these metrics play a pivotal role in assessing accuracy and reliability.
Binary Classification: The Four Categories
Before diving into the metrics, it’s crucial to grasp the fundamental concept of binary classification, where outcomes fall into one of four categories:
1. True Positive (TP): Correctly identified as positive.
2. True Negative (TN): Correctly classified as negative.
3. False Positive (FP): Falsely classified as positive (Type I Error).
4. False Negative (FN): Falsely classified as negative (Type II Error).
These categories encapsulate the correctness and labeling of the classification, forming the basis for evaluating model performance.
Sensitivity — Prioritizing Positives
Sensitivity, also known as True Positive Rate, measures the ratio of correctly identified positive instances to the total actual positive instances:
Sensitivity = TP / (FN + TP)
It’s instrumental in scenarios where identifying positives holds high priority, such as security checks in airports.
Specificity — Focusing on Negatives
Specificity, or True Negative Rate, quantifies the ratio of correctly classified negative instances to the total actual negative instances:
Specificity = TN / (FP + TN)
It takes center stage when distinguishing negatives is critical, like diagnosing health conditions before treatment.
Precision — Accurate Positives
Precision assesses the proportion of correctly classified positive instances out of all predicted positives:
Precision = TP / (TP + FP)
Recall — Twins with Sensitivity
Recall is synonymous with Sensitivity and measures the ratio of true positives to the total actual positives:
Recall = TP / (FN + TP)
Precision and Recall go hand in hand, forming the basis for the F1 Score.
F1 Score — The Harmonious Metric
The F1 Score is a holistic measure of a model’s classification ability, striking a balance between Precision and Recall:
F1 Score = 2 * (Precision * Recall) / (Precision + Recall)
It’s often preferred over regular accuracy as it considers both false positives and false negatives.
Demystifying with the Confusion Matrix
The Confusion Matrix serves as a comprehensive summary of prediction results in binary classification. Let’s consider a scenario where we aim to determine if a person is diseased based on certain features.

The matrix captures four key metrics:
- True Positives (TP): Correctly predicted positives.
- True Negatives (TN): Correctly predicted negatives.
- False Positives (FP): Incorrectly predicted positives (Type I Error).
- False Negatives (FN): Incorrectly predicted negatives (Type II Error).
The accuracy, sensitivity, specificity, false positive rate, and false negative rate can be calculated based on these metrics.
Accuracy: The ratio of correctly predicted labels to the total predicted labels:
Accuracy = (TP + TN) / (TP + TN + FP + FN)
Sensitivity (True Positive Rate): The ratio of actual positives correctly predicted:
Sensitivity = TP / (TP + FN)
Specificity (True Negative Rate): The ratio of actual negatives correctly predicted:
Specificity = TN / (FP + TN)
False Positive Rate: The ratio of actual negatives incorrectly predicted:
False Positive Rate = FP / (FP + TN)
False Negative Rate: The ratio of actual positives incorrectly predicted:
False Negative Rate = FN / (TP + FN)
Precision (Positive Predictive Rate): The ratio of actual positives correctly predicted to the total predicted positives:
Precision = TP / (TP + FP)
Recall (Sensitivity/True Positive Rate): The same as Sensitivity, measuring the ratio of true positives to actual positives.
Simplified Representation:


In conclusion, grasping these metrics and the Confusion Matrix empowers you to comprehensively evaluate model performance and make informed decisions in various fields, from healthcare to machine learning. Understanding these terminologies provides clarity and confidence in interpreting and applying them effectively.