Hello everyone, I have been trying to get through this lab for a very long time but I still don´t know what is my error, could you help me please? Is from the week-1 C3W1_Assignment
I got the correct output of the exercise 1 but in the exercise 2 I got this error, when trying to solve this:
“Implement the function to compute 𝑃(word∣spam)𝑃(word∣spam) and 𝑃(word∣ham)”
I got this error message:
----> 1 print(f"P(lottery | spam) = {prob_word_given_class(‘lottery’, cls = ‘spam’, word_frequency = word_frequency, class_frequency = class_frequency)}")
I suspect the values I included in this part are not correct:
Get the amount of times the word appears with the given class (class is stores in spam variable)
amount_word_and_class = word_frequency[word]['spam']
p_word_given_class = amount_word_and_class/[cls]['spam']
I also got this error message underlined
p_word_given_class = amount_word_and_class/[cls][‘spam’]