All problems
Bayes Factor
Problem
Return the log Bayes factor comparing two models:
log BF = log_evidence1 - log_evidence0
Positive values favor model 1. Both inputs are log evidences from the same data.
Hint
Working in logs turns the evidence ratio into a difference.
Test cases
case 1
in: [0,0]
expected: 0
case 2
in: [5,3]
expected: 2
case 3
in: [-10,-12]
expected: 2
case 4
in: [1,2]
expected: -1
Starter codePython
def bayes_factor(log_evidence1, log_evidence0):
# Your code here
pass4 test cases · run your code against them in the editor