Error in get_ration function of the naive bayes assignment

Please help resolve this.

Following is my error output:

Please compare your code to the formula given in the instructions, as highlighted in this screenshot:

My theory is that your code omits the +1 in both the numerator and denominator. It’s been a long time since I watched the lectures for this course, so I forget whether they explained this in the lectures, but the reason for the +1 is to avoid divide by zero problems. Note that you may well have 0 as the count for either positive or negative words.

I tried making that mistake and I get the exact wrong answers that you show. :nerd_face:

3 Likes

That was just it! It solved the problem.

Thank you so much.

1 Like