Skip to content

[FAQ Bot] NEW: Where do TPR (True Positive Rate) and FPR (False Positive Rate) come fro - #473

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
faq-bot/issue-472
Open

github-actions[bot] wants to merge 1 commit into
mainfrom
faq-bot/issue-472

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

✨ FAQ NEW

Course: machine-learning-zoomcamp
Section: module-4 (TPR/FPR and ROC-related ideas are evaluation/metrics for classification, which belong in the classification evaluation module.)
Related Issue: #472

Question

Where do TPR (True Positive Rate) and FPR (False Positive Rate) come from, and why are the formulas written this way?

Decision Rationale

No existing FAQ directly explains where TPR/FPR formulas come from and why they are written that way. The proposal’s confusion-table/threshold reasoning adds distinct conceptual detail beyond the existing threshold-specific entry.

Placement Details

  • Section ID: module-4
  • Sort Order: End of section
  • Filename Slug: tpr-fpr-origin-and-formulas

🤖 Generated by FAQ Bot

Closes #472

@saeidsoheily

saeidsoheily commented Oct 21, 2026 •

Copy link
Copy Markdown

TPR and FPR come from the confusion matrix, which compares a classification model's predictions with the actual outcomes.

1. Understanding the confusion matrix
--------------------- Predicted Positive-----------Predicted Negative
Actual Positive------- TP (True Positive)----------FN (False Negative)
Actual Negative----- FP (False Positive)-----------TN (True Negative)

  • TP: Correctly predicted positive.
  • FN: Incorrectly predicted negative.
  • FP: Incorrectly predicted positive.
  • TN: Correctly predicted negative.

2. True Positive Rate (TPR)
TPR = TP / (TP+FN)

TPR measures the proportion of actual positive cases that the model correctly identifies.

Why is the denominator TP + FN?
Because these are all the actual positive cases, regardless of what the model predicted.

Example: If 100 customers actually churn and the model correctly identifies 80:
TPR=80 / (80+20)=0.80
This means the model detects 80% of customers who churn.
(TPR is also called Recall or Sensitivity.)

3. False Positive Rate (FPR)
FPR = FP / (FP+TN)

FPR measures the proportion of actual negative cases that the model incorrectly predicts as positive.

Why is the denominator FP + TN?
Because these are all the actual negative cases.

Example: If 900 customers do not churn, but the model incorrectly predicts that 90 will churn:
FPR=90 / (90+810)=0.10

This means 10% of customers who would not churn are incorrectly classified as churners.

4. How TPR and FPR relate to the ROC curve
The ROC curve plots:

  • X-axis: FPR
  • Y-axis: TPR

Each point corresponds to a different classification threshold.

As we lower the threshold, the model generally predicts more cases as positive, increasing both TPR and FPR.

5. Why both metrics matter
A model that predicts everyone as positive achieves:

  • TPR = 1.0 (detects all positives)
  • FPR = 1.0 (incorrectly flags all negatives)

That is why a high TPR alone is not enough. A good classifier aims for high TPR and low FPR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Derivation of True Positive Rate (TPR) and False Positive Rate (FPR)

1 participant