Skip to content
C

Problem 3: Calculate TPR and FPR at a Specific Threshold

Easypython

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.

Input (stdin)

Output

Run your code to see output here...