27-2 Naive Bayes mission potential mistakes?

In the Naive Bayes mission step 2 I think i have spotted 2 mistakes. Could someone check if I am right or wrong?

The functions that calculate the conditional probabilities, I think that they use wrong denominators as they use the length of the whole dataset while I think it should be the length of a subset of the whole dataset

e.g lets use this function:

calc_ran_probability_given_y (ran_label, y_label, days)

calc_ran_probability_given_y ('ran', ' was tired', days)

This is basically P(ran|was tired) = P(ran and was tired) / P(was tired) = (# of elements where both conditions apply) / (# of elements where was tired applies) = 3/5 = 0.6

But the code does this: P(ran|was tired) = (# of elements where both conditions apply) / (# of all elements) = 3/7 = 0.42


You’re absolutely right, Kostasmandilass. Nice job.

There are also some issues on screen 4, as you can see on this question.

1 Like

Thanks a lot for your feedback!!

As a heads-up, we’re currently working on a new course on Conditional Probability, which includes a new mission and a guided project on multinomial Naive Bayes – this new course should be ready by November.

Late edit: the Conditional Probability course is up.