Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-237

Expected Value Decision Threshold

Problem

Compute the break-even probability for acting: cost / value.

Return 0.0 when value <= 0.

Hint

Above the break-even probability the action has positive expected value.

Test cases

case 1
in: [2,10]
expected: 0.2
case 2
in: [5,5]
expected: 1
case 3
in: [0,10]
expected: 0
case 4
in: [3,0]
expected: 0
Starter codePython
def expected_value_threshold(cost, value):
    # Your code here
    pass

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