Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-406

Negative Predictive Value from Counts

Problem

The negative predictive value is TN / (TN + FN), the probability a negative prediction is correct. Return 0.0 when the denominator is zero.

Given the counts, return the NPV.

Hint

Condition on the prediction being negative, not on the truth.

Test cases

case 1
in: [9,1]
expected: 0.9
case 2
in: [2,2]
expected: 0.5
case 3
in: [0,5]
expected: 0
Starter codePython
def negative_predictive_value(tn, fn):
    # Your code here
    pass

3 test cases · run your code against them in the editor