Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-248

Bernoulli Fisher Information

Problem

Return the Fisher information of n Bernoulli trials with success probability p:

I(p) = n / (p * (1 - p))

Hint

Information is smallest when the coin is fair, since p(1-p) is largest there.

Test cases

case 1
in: [0.5,1]
expected: 4
case 2
in: [0.5,10]
expected: 40
case 3
in: [0.25,1]
expected: 5.333333333333333
case 4
in: [0.1,5]
expected: 55.55555555555555
Starter codePython
def bernoulli_fisher_information(p, n):
    # Your code here
    pass

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