Compute the area under a ROC curve with the trapezoidal rule. For consecutive points (xi,yi)=(FPRi,TPRi):
AUC=i=1∑M−1(xi+1−xi)2yi+yi+1Here, M is the number of curve points. Return the summed area as a Python float.
Input: fpr = [0, 0, 1], tpr = [0, 1, 1]
Output: 1.0
Explanation: The curve rises vertically to a true-positive rate of one before spanning the full false-positive range.
Input: fpr = [0, 1], tpr = [0, 1]
Output: 0.5
Use np.diff(fpr) for trapezoid widths.
Use 0.5 * (tpr[:-1] + tpr[1:]) for their heights.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Compute the area under a ROC curve with the trapezoidal rule. For consecutive points (xi,yi)=(FPRi,TPRi):
AUC=i=1∑M−1(xi+1−xi)2yi+yi+1Here, M is the number of curve points. Return the summed area as a Python float.
Input: fpr = [0, 0, 1], tpr = [0, 1, 1]
Output: 1.0
Explanation: The curve rises vertically to a true-positive rate of one before spanning the full false-positive range.
Input: fpr = [0, 1], tpr = [0, 1]
Output: 0.5
Use np.diff(fpr) for trapezoid widths.
Use 0.5 * (tpr[:-1] + tpr[1:]) for their heights.
Sign in to take notes on this problem
Accepts: array
Accepts: array