Loading...
Compute the ROC curve points (TPR and FPR at each threshold).
Given true labels and predicted probabilities, compute the True Positive Rate (TPR) and False Positive Rate (FPR) at each unique threshold.
For each unique predicted probability (used as threshold, sorted descending), classify all predictions ≥ threshold as positive:
TPR=TP+FNTP,FPR=FP+TNFP
Return a list of (fpr, tpr) tuples rounded to 4 decimal places, starting from (0, 0) when threshold is above the max prediction, ending at (1, 1) when threshold is 0.
y_true = [1, 0, 1, 0] y_scores = [0.9, 0.4, 0.65, 0.3]
[(0.0, 0.0), (0.0, 0.5), (0.0, 1.0), (0.5, 1.0), (1.0, 1.0)]