All problems
Decision Curve Net Benefit
Problem
Return the net benefit tp/n - (fp/n) * (threshold / (1 - threshold)) for a decision threshold. Return 0.0 when n <= 0 or the threshold is not strictly between 0 and 1.
Hint
It compares the value of true positives against the harm of false positives at the given threshold.
Test cases
case 1
in: [30,10,100,0.2]
expected: 0.27499999999999997
case 2
in: [50,50,100,0.5]
expected: 0
case 3
in: [0,0,100,0.3]
expected: 0
case 4
in: [100,0,100,0.1]
expected: 1
case 5
in: [10,10,100,0]
expected: 0
Starter codePython
def decision_curve_net_benefit(tp, fp, n, threshold):
# Your code here
pass5 test cases · run your code against them in the editor