C3W1 Naive Bayes Assignment - Help with prob_email_given_class Function

I have been at this function for the past week and I feel like it’s much easier than I think it is…are there any further hints someone can provide as to how to approach this function? Thank you! (I purposely put None in the places that are supposed to have code to not go against the Conduct policy)
Codes removed as it is against community guidelines to share correct or incorrect codes from any grade cells on public post, please refer FAQ section, Code of Conduct

Hi @emilyt1217

You should iterate directly over treated_email. For each word, you multiply the current probability by the conditional probability of the word given the class. If the word isn’t in the dictionary, you might want to handle it with smoothing (as instructed). Focus on iterating through the email and updating the probability accordingly.

Hope it helps! Feel free to ask id you need further aasistance.

Thank you, I will try that now and let you know if it works.

Sure! You’re welcome!

Okay, I thought I had an understanding, but it turns out I don’t…can I message you directly about this?

Sure, feel free to message me for further discussions.


image removed as it has a grade cell codes and posting grade cells codes correct or incorrect is against community guidelines, kindly refrain from posting any codes on public post threads. if a mentor wants to look at your codes, they will ask you to DM them. For better understanding and how to use discourse community, refer FAQ section Code of Conduct and How to Use the Forum