All problems
Bayes Posterior Three Hypotheses
Problem
Given prior probabilities and likelihoods for three mutually exclusive hypotheses, the posterior is prior_i * likelihood_i normalized to sum to one.
Given the priors and likelihoods, return the posterior list.
Hint
Multiply priors by likelihoods, then renormalize.
Test cases
case 1
in: [[0.2,0.3,0.5],[0.1,0.5,0.2]]
expected: [0.07407407407407408,0.5555555555555555,0.37037037037037035]
case 2
in: [[1,0,0],[0.4,0.6,0.9]]
expected: [1,0,0]
case 3
in: [[0.25,0.25,0.5],[0.8,0.8,0.2]]
expected: [0.4,0.4,0.2]
Starter codePython
def bayes_posterior_three_hypotheses(priors, likelihoods):
# Your code here
pass3 test cases · run your code against them in the editor