All problems
Youden's J Statistic
Problem
Compute Youden's J statistic: TPR - FPR, where TPR = TP/(TP+FN) and FPR = FP/(FP+TN) for positive class 1.
Each rate is 0.0 when its denominator is zero. Empty input returns 0.0.
Hint
J equals recall + specificity - 1.
Test cases
case 1
in: [[1,0,1,0],[1,0,1,1]]
expected: 0.5
case 2
in: [[1,0,1,0],[1,0,1,0]]
expected: 1
case 3
in: [[1,0,1,0],[0,1,0,1]]
expected: -1
case 4
in: [[],[]]
expected: 0
Starter codePython
def youdens_j(y_true, y_pred):
# Your code here
pass4 test cases · run your code against them in the editor