All problems
Thompson Posterior Update
Problem
Update a Beta-Bernoulli posterior after observing successes and failures. Return [alpha + successes, beta + failures].
Hint
The Beta prior is conjugate to the Bernoulli likelihood, so updating is just counting.
Test cases
case 1
in: [1,1,3,2]
expected: [4,3]
case 2
in: [0.5,0.5,0,0]
expected: [0.5,0.5]
case 3
in: [2,5,0,4]
expected: [2,9]
Starter codePython
def thompson_posterior_update(alpha, beta, successes, failures):
# Your code here
pass3 test cases · run your code against them in the editor