Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-261

Bonferroni Intersection Lower Bound

Problem

Bonferroni's inequality lower-bounds the probability that all events occur: P(intersection) >= sum(probabilities) - (number of events - 1), truncated below at 0. Return the bound, which is 1.0 for an empty list.

Hint

The complement of the intersection is bounded by the sum of the complement probabilities.

Test cases

case 1
in: [[0.9,0.8,0.7]]
expected: 0.40000000000000036
case 2
in: [[0.5,0.5]]
expected: 0
case 3
in: [[0.99,0.99,0.99,0.99,0.99]]
expected: 0.9500000000000002
case 4
in: [[]]
expected: 1
case 5
in: [[0.2,0.3]]
expected: 0
Starter codePython
def bonferroni_intersection_bound(probs):
    # Your code here
    pass

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