Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-191

Bonferroni Count

Problem

Count how many p-values are significant after Bonferroni correction: p_i <= alpha / m, where m is the number of hypotheses.

Empty input returns 0.

Hint

Divide alpha by the number of tests before comparing.

Test cases

case 1
in: [[0.001,0.01,0.04],0.05]
expected: 2
case 2
in: [[0.02,0.03],0.05]
expected: 1
case 3
in: [[0.5],0.5]
expected: 1
case 4
in: [[],0.05]
expected: 0
Starter codePython
def bonferroni_count(p_values, alpha):
    # Your code here
    pass

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