Programming Assignment: Naive Bayes_Deep learning

I am not sure why the grade is 0 when all the tests have passed. Can anyone assist on this?

{mentor edit: code attachment removed}

1 Like

Please do not share your code on the forum. That is not allowed by the Code of Conduct.
I have edited your post to remove the code.

Tips:

  • Passing the tests in the notebook does not prove your code is perfect. The grader uses different tests and a different runtime environment.
  • What is the detailed feedback from the grader? Please post a screen capture image.
  • Do not rename your notebook. What you posted has an incorrectly formatted file extension “.ipynb.ipynb”. That will make the grader unhappy.

I think this thread is labeled incorrectly. It’s not Multi-Agent Systems with CrewAI, it’s Mathematics for Machine Learning. And the notebook name says “C1_W1”, but the probability and statistics course is C3 in that series.

1 Like

I checked and in both versions (Coursera and DLAI) of that course, the notebook file has the same name:

C3W1_Assignment.ipynb

Not the name of your file:

C1_W1_Assignment_v2.ipynb.ipynb

I did a quick comparison between your code and mine and you’ve made one common mistake: when computing the word frequencies, you’ve initialized the ham and spam counts to 0. That might seem intuitively obvious, but they explain in the instructions that we need to do it differently:

** 4.1.1 Handling 0 in the Product*
** Encountering a word that only appears in spam emails or never appears in a spam email may result in 𝑃(word∣spam)=0*
** (or the ham analog), leading to the entire product being 0*
** . This scenario is undesirable as a single word could make the entire probability 0*
** . 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 0*
** appearing in the computations.*

(Sorry, that’s not very legible, but find section 4.1.1 of the instructions and have a look.)