Please help
Please ignore . Issue resolved by initializing the spam and ham to 1
2 Likes
Yes, this is a common mistake. To be fair, they did their best to help you out here by explicitly discussing this point in the instructions:
Encountering a word that only appears in spam emails or never appears in a spam email may result in 𝑃(word∣spam)=0P(word∣spam)=0 (or the ham analog), leading to the entire product being 00. This scenario is undesirable as a single word could make the entire probability 00. To mitigate this, you will **start by counting spam/ham appearances for every word from 1** . By artificially assuming that there is at least one spam and one ham email with every word, you eliminate the possibility of 00 appearing in the computations.