Calculate Number of True Positives
In binary classification models, a true positive is a correct prediction of the positive class. This calculator helps you determine the number of true positives based on your model's performance metrics.
What is a true positive?
A true positive occurs when a classification model correctly identifies an instance as belonging to the positive class. In medical testing, for example, a true positive would be when a test correctly identifies a patient as having a disease.
True positives are one of the four possible outcomes in a binary classification system:
- True Positive (TP): Correctly identified positive cases
- False Positive (FP): Incorrectly identified positive cases
- True Negative (TN): Correctly identified negative cases
- False Negative (FN): Incorrectly identified negative cases
Key Concept
The confusion matrix is a table that summarizes the performance of a classification model by showing these four outcomes.
Formula for true positives
The number of true positives (TP) can be calculated using the following formula:
Formula
TP = (Sensitivity × (TP + FN)) / (Sensitivity + Specificity)
Where:
- Sensitivity = TP / (TP + FN)
- Specificity = TN / (TN + FP)
Alternatively, if you know the total number of positive cases and the false positive rate, you can use:
Alternative Formula
TP = Total Positive Cases - FP
Worked example
Let's calculate the number of true positives for a model with the following metrics:
- Total positive cases: 100
- False positive rate: 5%
Using the alternative formula:
- Calculate false positives: 5% of 100 = 5
- Calculate true positives: 100 - 5 = 95
So, the model has 95 true positives.
Interpreting results
A high number of true positives indicates your model is good at identifying positive cases. However, you should also consider:
- False positives: Cases incorrectly identified as positive
- False negatives: Cases incorrectly identified as negative
- Precision: TP / (TP + FP)
- Recall: TP / (TP + FN)
These metrics together provide a complete picture of your model's performance.
FAQ
What is the difference between true positives and false positives?
A true positive is a correct prediction of the positive class, while a false positive is an incorrect prediction of the positive class.
How do I calculate true positives from a confusion matrix?
The true positives are the values in the top-left cell of the confusion matrix.
What is a good number of true positives?
A good number depends on your specific application and the trade-offs between false positives and false negatives.