'Wrong values for loglikelihood dictionary.' Error on C1_W2 assignment

I need some help with the assignment. I think the math is right but I’m getting this error and I don’t know what to do because I just can’t find the error.

I check what the test case was and reproduced in another cell. In the next image, I show the word, my loglikehood and the one expected by the test case. For this result I used train_naive_bayes(freqs, train_x, train_y) to get the loglikehood.

image

I’ll not show what my code is in the forum, but my code lab is: xkhvtnryyjlm

Hi @Xuxubabr

Looking at the values, it looks like you might have not applied smoothing ( +1 in the nominator). It might also be the case, that you implemented count_tweets incorrectly. It’s hard to suggest anything more from the error.

Hi @arvyzukai . Thank you for your answer. I’m adding the +1 in the nominator and the equation look just like the one shown in the ‘calculate log likehood’ on the markdown cell above the code. The count_tweet pass all the testing without error. I’m completly lost and what can this error be because seems the code is just right and the difference is to small. Is it possible to someone to see my notebook and give me some clarity in this matter?

@Xuxubabr I sent you a private message regarding this issue.

Solved with the help of @arvyzukai . Thank you so much!

1 Like

I encounter the same issue, can you help me to solve it. My code lab is rhdfpuzugapm

nvm, I corrected my code by reading the discussion here Wrong values for loglikelihood dictionary. Linking here for anyone who looking for the solution