Skip to content
DeepForgeby svx
All problems
HardML Fundamentalsml-193

Benjamini-Hochberg Count

Problem

Count rejections with the Benjamini-Hochberg FDR procedure: sort p-values ascending and return the largest k such that p_(k) <= k/m * alpha (0 if none).

Empty input returns 0.

Hint

Find the largest k satisfying the BH inequality, then reject all hypotheses up to that rank.

Test cases

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

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