All problems
Negative Predictive Value
Problem
Compute the negative predictive value: TN / (TN + FN), the share of negative predictions that are correct.
Return 0.0 when the denominator is zero or the input is empty.
Hint
It is precision applied to the negative class.
Test cases
case 1
in: [[0,0,1,1],[0,0,0,1]]
expected: 0.6666666666666666
case 2
in: [[0,0],[0,0]]
expected: 1
case 3
in: [[1,1],[1,1]]
expected: 0
case 4
in: [[],[]]
expected: 0
Starter codePython
def negative_predictive_value(y_true, y_pred):
# Your code here
pass4 test cases · run your code against them in the editor