Confused about course demo 3

Hello
I’m confused about the demo 3 notebook
When using bigrams and unigrams (back-off or interpolation), it is used
# pre-calculated probabilities of all types of n-grams
trigram_probabilities = {(‘i’, ‘am’, ‘happy’): 0.15}
bigram_probabilities = {( ‘am’, ‘happy’): 0.3}
unigram_probabilities = {‘happy’: 0.4}

shouldn’t it be
# pre-calculated probabilities of all types of n-grams
trigram_probabilities = {(‘i’, ‘am’, ‘happy’): 0.15}
bigram_probabilities = {(‘i’, ‘am’): 0.3, ( ‘am’, ‘happy’): 0.3}
unigram_probabilities = {‘i’:0.2, ‘am’:0.2, ‘happy’: 0.4}

should not be 2 bigrams and 3 unigrams presents ?

and in this case, should not we sum the lambdas_3 multiplied by each unigram prob, and the same for bigrams probs and lambda_2 ?

thanks for any clarification

Hi Pascal_Augeraud,

There are different ways in which interpolation can be performed. In the notebook, simple linear interpolation is used, which uses the trigram, bigram, and unigram probabilities as presented. See, e.g., this book chapter.