Explore Library
Code QuizIntermediate

Combining Probabilities in Log Space

Spot why combining independent probabilities in log space produces the wrong result.

Codepython
import math

def log_prob_product(probs):
    # combine independent event probabilities in log space
    total = 0.0
    for p in probs:
        total *= math.log(p)
    return total

print(log_prob_product([0.5, 0.2, 0.1]))

What is the bug in this log-space probability combination?