Skip to content
CampusEduX

Problem 3: Calculate TPR and FPR at a Specific Threshold

Easypython
Learn the Concept: ROC-AUC Curve

Problem Description

Write a Python program that manually calculates TPR and FPR at a specific, given probability threshold (without using roc_curve() directly for this specific calculation).

Input

Actual labels, predicted probabilities, and a threshold value.

Output

The TPR and FPR at that specific threshold.

Constraints

  • Threshold between 0 and 1.

Example Input

text
actual=[0,0,1,1], probabilities=[0.2,0.4,0.6,0.9], threshold=0.5

Example Output

text
TPR: 1.0 FPR: 0.0

Concepts Covered

Manual threshold application, TPR/FPR calculation.

Related Problems

  • Problem 1: Calculate and Plot a Basic ROC Curve
    Easy · python
    Solve Problem
  • Problem 2: Calculate AUC for Two Different Models
    Easy · python
    Solve Problem
  • Problem 4: Compare AUC Across Different Feature Sets
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...