Quick answer
The true positive rate (TPR), also called sensitivity or recall, is the share of actual positive cases a classifier or test correctly identifies: TP ÷ (TP + FN). It shows how much is caught but not how many negatives are wrongly flagged, so it is read with the false positive rate or precision.
Formula: TPR = TP ÷ (TP + FN), where TP = true positives and FN = false negatives; false negative rate = 1 − TPR
What is the true positive rate?
The true positive rate (TPR) is the share of actual positive cases that a classifier or test correctly flags as positive. If 200 sessions really are bots and a detector catches 170 of them, its TPR is 170 ÷ 200 = 85%. The same quantity is called sensitivity in medicine, recall in machine learning, the hit rate or probability of detection in signal detection, and statistical power when the "classifier" is a hypothesis test.
TPR answers one question only: of the cases that are really positive, how many did we catch? It says nothing about how many negatives were wrongly flagged, which is why it is always read next to the false positive rate or precision.
How is the true positive rate calculated?
Every prediction from a yes/no classifier falls into one of four cells of a confusion matrix:
| Predicted positive | Predicted negative | |
|---|---|---|
| Actually positive | True positive (TP) | False negative (FN) |
| Actually negative | False positive (FP) | True negative (TN) |
The true positive rate uses only the top row:
TPR = TP ÷ (TP + FN)
The denominator is every actual positive, whether caught or missed. Its complement is the false negative rate, FN ÷ (TP + FN) = 1 − TPR. Google's machine learning course defines recall the same way: the proportion of all actual positives that were classified correctly as positives.
Worked example: bot detection on 1,000 sessions
Sample data. An analytics team checks its bot filter against 1,000 sessions whose true status it has verified by hand: 200 are bots (positive) and 800 are humans (negative). The filter flags 180 sessions as bots.
| Flagged as bot | Counted as human | Total | |
|---|---|---|---|
| Actually bot | TP = 170 | FN = 30 | 200 |
| Actually human | FP = 10 | TN = 790 | 800 |
| Total | 180 | 820 | 1,000 |
From this one table:
- True positive rate (recall, sensitivity) = 170 ÷ 200 = 85.0%. The filter catches 85% of bots.
- False negative rate = 30 ÷ 200 = 15.0%. These 30 bots stay in the human reports.
- False positive rate = FP ÷ (FP + TN) = 10 ÷ 800 = 1.25%. Ten real visitors are hidden from the human reports.
- Specificity (true negative rate) = 790 ÷ 800 = 98.75%.
- Precision = TP ÷ (TP + FP) = 170 ÷ 180 = 94.4%. Of sessions labelled as bots, 94.4% really are.
- Accuracy = (170 + 790) ÷ 1,000 = 96.0%.
What the reader of an analytics report feels is the effect on the human count. The report shows 820 human sessions (790 real humans plus 30 missed bots) instead of the true 800, a 2.5% overcount. If 40 of the real humans converted, the true conversion rate is 40 ÷ 800 = 5.00%, but the report shows 40 ÷ 820 = 4.88%. Raising the TPR shrinks that gap; raising it by flagging more aggressively would also raise the false positive rate and hide more real visitors. For how bots distort other metrics, see bot traffic.
How is TPR different from FPR, precision and specificity?
| Metric | Formula | Question it answers | Example value |
|---|---|---|---|
| True positive rate (recall, sensitivity) | TP ÷ (TP + FN) | Of real positives, how many did we catch? | 85.0% |
| False negative rate | FN ÷ (TP + FN) | Of real positives, how many did we miss? | 15.0% |
| False positive rate | FP ÷ (FP + TN) | Of real negatives, how many did we wrongly flag? | 1.25% |
| Specificity (true negative rate) | TN ÷ (TN + FP) | Of real negatives, how many did we correctly clear? | 98.75% |
| Precision (positive predictive value) | TP ÷ (TP + FP) | Of everything we flagged, how much was right? | 94.4% |
| Accuracy | (TP + TN) ÷ total | Of everything, how much was right? | 96.0% |
Two pairs are easy to confuse. TPR and precision share the numerator but not the denominator: TPR divides by actual positives, precision by predicted positives. TPR and FPR are the two axes of the ROC curve and move together when you change the threshold.
Accuracy alone is misleading when positives are rare. Google's course gives the extreme case: on a dataset where 1% of cases are positive, a model that always predicts negative scores 99% accuracy while catching nothing, a TPR of 0%.
What is the trade-off between TPR and the false positive rate?
Most classifiers output a score, and a threshold turns the score into yes or no. Lowering the threshold flags more cases, which raises TPR and FPR together. Plotting TPR against FPR for every threshold gives the ROC curve; Fawcett's widely cited introduction to ROC analysis describes it as the trade-off between benefits (true positives) and costs (false positives).
Sample data: a churn model scores 1,000 subscribers, 100 of whom actually cancel the next month.
| Threshold | Flagged | TP | FP | TPR | FPR | Precision |
|---|---|---|---|---|---|---|
| 0.3 | 265 | 85 | 180 | 85% | 20% | 32.1% |
| 0.5 | 160 | 70 | 90 | 70% | 10% | 43.8% |
| 0.7 | 72 | 45 | 27 | 45% | 3% | 62.5% |
Which row is right depends on the cost of each error. If the retention offer is a cheap email, the 0.3 threshold catches 85% of churners and the 180 false alarms cost little. If it is a 30% discount, the 0.7 threshold avoids giving it to 153 customers who would have stayed anyway, at the price of missing more than half the churners. Choosing the threshold is a business decision; TPR only describes one side of it. Model-building choices for this case are covered in customer churn prediction.
How does the true positive rate relate to statistical power?
A hypothesis test is a classifier too: it labels each result "effect" (reject the null) or "no effect". When a real effect exists, the probability that the test detects it is the test's statistical power, which is exactly its true positive rate. The significance level α is its false positive rate.
| Classifier term | Hypothesis-test term |
|---|---|
| True positive rate | Power (1 − β) |
| False negative rate | Type II error rate (β) |
| False positive rate | Type I error rate (α) |
| Specificity | 1 − α |
So "80% power" means: if ten tests each have a real effect of the planned size, about eight will come out significant and two will be missed. Raising power (TPR) at a fixed α needs a larger sample or a larger effect. The two error types are compared in type I vs type II error.
What mistakes do people make with the true positive rate?
- Reporting TPR alone. A filter that flags every session as a bot has 100% TPR and is useless. Always pair it with FPR or precision.
- Confusing TPR with precision. "85% of bots caught" and "85% of flagged sessions are bots" are different claims with different denominators.
- Using accuracy on imbalanced data. With rare positives, accuracy is dominated by true negatives.
- Measuring on a non-representative sample. TPR measured only on known, easy bots overstates performance on new ones.
- Ignoring base rates. The same TPR and FPR give very different precision when positives are 1% rather than 20% of cases.
Bot detection in TapCub
The bot example maps directly onto how TapCub separates bots from people. TapCub doesn't publish a TPR figure for its detection, and what you can see is how the two kinds of error show up:
- Positives go to their own report. New projects default to Detect and report separately: recognised bots appear only in Web analytics › Bots and don't enter human visitors, sessions or pageviews. Each bot row shows the detection layers it matched and a trust level (verified, suspected or unknown). How the layers work is in how bot detection works.
- False positives can be reported. If a row is a real person or your own monitoring tool flagged wrongly, report it as a false positive for a platform admin to review: report a bot false positive.
- False negatives need a check from your side. A bot that isn't recognised stays in the human reports, like the 30 missed bots in the example. A sudden spike of very short, single-page sessions from one source or location in Web analytics › Sessions is worth a closer look.
- Coverage depends on collection. With only the page script, TapCub sees bots that execute JavaScript; crawlers that don't run scripts need server records or log import to appear at all.
Sources
- Google for Developers. Classification: Accuracy, recall, precision, and related metrics, Machine Learning Crash Course — recall (TPR), FPR and precision formulas; the 99% accuracy example. Checked 2026-11-28.
- Tom Fawcett. An introduction to ROC analysis. Pattern Recognition Letters 27(8), 861–874, 2006. Checked 2026-11-28.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Engineer
Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.