Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-126

MLE for Poisson

Problem

Maximum likelihood estimate of the Poisson rate from a list of observed counts, which is the sample mean:

lam_hat = sum(counts) / len(counts).

Return 0.0 for an empty list.

Hint

The score equation for the Poisson rate gives the sample mean.

Test cases

case 1
in: [[1,2,3]]
expected: 2
case 2
in: [[0,0,0,4]]
expected: 1
case 3
in: [[5]]
expected: 5
case 4
in: [[]]
expected: 0
Starter codePython
def mle_poisson(counts):
    # Your code here
    pass

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