Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-059

Fisher Information 1D

Problem

Compute the Fisher information of a Bernoulli-logistic model with logit z.

Let p = 1 / (1 + exp(-z)); the Fisher information with respect to z is p * (1 - p). Return that value, which peaks at z = 0.

Hint

The Fisher information is the variance of the Bernoulli score.

Test cases

case 1
in: [0]
expected: 0.25
case 2
in: [1]
expected: 0.19661193324148185
case 3
in: [-2]
expected: 0.1049935854035065
case 4
in: [5]
expected: 0.006648056670790033
Starter codePython
def fisher_information_1d(z):
    # Your code here
    pass

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