Code QuizIntermediate Bigram Language Model Probability
Computing a conditional bigram probability with the wrong denominator.
Codepython
bigram_count = {("i", "am"): 3}
unigram_count = {"i": 10, "am": 8}
# We want P(am | i) = count(i, am) / count(i)
prob = bigram_count[("i", "am")] / unigram_count["am"]
print(prob)What is the bug in this bigram probability calculation?