Skip to content

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

Open

Description

@huyyhoangtr-boop

Course

machine-learning-zoomcamp

Question

Where do True Positive Rate (TPR) and False Positive Rate (FPR) come from? Why do we have their formulas as now?

Answer

The TPR and FPR formulas are built based on which variable we want to maximize and which to minimize. Consider a climate detector that detects rain: 1 denotes rain, and 0 denotes there's no rain. We want the climate detector to be more efficient, which means the number of times predicting rain + truly rain (True Positive) is maximised, and the number of times it predicts no rain when it truly rains (False Positive) is minimized. However, examining only those two variables for the model performance is not a good approach, as it depends on how large the dataset is.

Notably, looking at the tree diagram that derives the confusion table, we see that TN goes up when FP goes down and FT goes down when TP goes up. You can verify it by plotting the four variables across the thresholds to see the changes. Therefore, it is good to take FP and TN into one formula, and TP and FT into another as well. Then we will have the TPR that goes to 1 when TP goes up and FPR that goes to 0 when FP goes down.

Checklist

  • I have searched existing FAQs and this question is not already answered
  • The answer provides accurate, helpful information
  • I have included any relevant code examples or links

Activity

  1. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    ✅ FAQ NEW proposal created in PR #473

    Please review and approve the changes.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions