A true positive (TP) is a test example whose true class is positive and which the classifier correctly predicted as positive. It’s one of the four entries of the Confusion matrix for binary classification, alongside True negative (TN), False positive (FP), and False negative (FN).
In context: if the positive class is patient has heart disease, a true positive is a patient who actually has the disease and was correctly flagged by the model. If the positive class is email is spam, a true positive is a spam message that was correctly classified as spam.
TP and TN make up the main diagonal of the confusion matrix, the cases the classifier got right. The classifier’s accuracy is .
Several metrics depend on TP in their numerator:
- Recall (sensitivity, TPR) = — of actual positives, what fraction the classifier caught.
- Precision = — of predicted positives, what fraction were actually positive.
- F1 score — the harmonic mean of precision and recall.
A classifier with many TPs is finding the positives it should find. Few TPs means it’s missing real positives, either because it’s too conservative (preferring to predict negative) or because it hasn’t learned the positive class well.
The labels positive and negative are arbitrary; which class we call positive depends on the question we’re asking. In medical screening, the diseased class is positive because that’s the case we want to catch. In quality control, the defect class is positive for the same reason. Swapping the labels swaps TP with TN and FP with FN; everything else follows.