True Positive
When a model makes a “yes” decision—like “this email is spam” or “this patient has the disease”—you want to know how many of those yeses are actually right. True positives are the cases where the model correctly flags something that truly is positive.
What a true positive really means
A true positive (TP) happens in a binary classification setting when:
- The real label is positive (the condition/event is present), and
- The model predicts positive.
In a confusion matrix, TPs are one of the four basic counts (TP, FP, TN, FN). Think of TP as “caught correctly.” If your fraud detector flags a transaction and it truly is fraud, that’s a TP.
Why it matters for metrics and trade-offs
TPs directly drive common evaluation metrics:
- Recall (Sensitivity, TPR) = TP / (TP + FN): how many real positives you catch.
- Precision = TP / (TP + FP): how many predicted positives are truly positive.
- F1 score balances precision and recall, so it depends on TP too.
Changing a model’s decision threshold usually changes TP along with FP and FN. In disease screening, you might accept more false alarms (FPs) to increase TPs and avoid missed cases (FNs).
How you’ll see it in practice
In scikit-learn, you can compute TP from the confusion matrix:
from sklearn.metrics import confusion_matrix
tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel()
That single number becomes a concrete handle for diagnosing model behavior: are you failing to catch positives, or just being too trigger-happy?
A True Positive is a prediction outcome where the model predicts the positive class and the ground-truth label is also positive (e.g., predicting “disease” for a patient who truly has the disease). True Positives are a core count in the confusion matrix and directly determine key evaluation metrics such as precision, recall, and F1 score; miscounting them distorts performance assessment and threshold selection.
Imagine a smoke alarm that’s supposed to ring only when there’s a real fire. A True Positive is when it rings and there really is a fire. It’s a “correct catch.”
In supervised learning, a model often makes yes/no decisions: “spam” or “not spam,” “disease” or “no disease,” “fraud” or “not fraud.” A True Positive happens when the model predicts “yes” and the real answer is also “yes.” Counting true positives helps you see how good the system is at spotting the important cases it’s meant to find.