Ex2 outout


the problem which he gave me different output

It appears your code is not handling the “ham” class correctly.

Notice that all your output numbers are different, although the 0 value that Tom points out is particularly scary. An error in the third or fourth decimal place is not a rounding error: it’s a real error.

There aren’t really very many moving parts in the prob_word_given_class function: are you sure your previous functions (e.g. get_word_frequency) passed their tests and that your notebook is in a consistent state. Try this:

Kernel → Restart and Clear Output
Save
Cell → Run All

Now carefully look through and make sure everything earlier passes and take a look at the numbers you showed above again. I got pretty much exact matches for the expected values:

i still can’t understand what i should do

It’s also possible that you might be using an obsolete version of the notebook.

i think so how can i update the notebook?

Please check your personal messages for instructions.