C3W1_exercise4 unittest ok inside lab - BUT failed on submission

Programming Assignment: Naive Bayes

Coursera-platform
C3W1 - Exercise4

My Issue is that inside the Lab in Jupyter the last exercise (4), called “Naive Bayes”
Is working

I could see that ny output and the expected matched

also the unit test returns

 All tests passed

But once I submited it, I got this one Failed with Error :

Failed test case: Wrong value decision for email = [‘energy’ ‘derivatives’ ‘conference’ ‘may’ ‘29’ ‘toronto’ ‘good’ ‘morning’
‘amy’ ‘vince’ ‘kaminski’ ‘need’ ‘following’ ‘lcd’ ‘projector’ ‘hook’
‘lap’ ‘tap’ ‘presentation’ ‘dinner’ ‘conference’ ‘organizers’ ‘speakers’
‘29’ ‘th’ ‘need’ ‘2’ ‘nights’ ‘28’ ‘th’ ‘29’ ‘th’ ‘hotel’ ‘reservations’
‘send’ ‘abstract’ ‘shortly’ ‘thanks’ ‘great’ ‘day’ ‘shirley’ ‘crenshaw’
‘713’ ‘853’ ‘5290’ ‘amy’ ‘aldous’ ‘03’ ‘31’ ‘2000’ ‘10’ ‘50’ ‘11’
‘shirley’ ‘crenshaw’ ‘enron’ ‘com’ ‘cc’ ‘subject’ ‘energy’ ‘derivatives’
‘conference’ ‘may’ ‘29’ ‘toronto’ ‘ms’ ‘crenshaw’ ‘thank’ ‘sending’ ‘bio’
‘quickly’ ‘exactly’ ‘looking’ ‘planning’ ‘compile’ ‘conference’
‘speakers’ ‘papers’ ‘distribution’ ‘participants’ ‘need’ ‘dr’ ‘kaminski’
‘contribution’ ‘several’ ‘weeks’ ‘abstract’ ‘presentation’ ‘soon’
‘possible’ ‘would’ ‘useful’ ‘conference’ ‘organizers’ ‘also’ ‘need’
‘following’ ‘information’ ‘dr’ ‘kaminski’ ‘audio’ ‘video’ ‘equipment’
‘requirements’ ‘presentation’ ‘joining’ ‘conference’ ‘organizers’
‘speakers’ ‘dinner’ ‘may’ ‘29’ ‘nights’ ‘staying’ ‘toronto’ ‘reserve’
‘room’ ‘conference’ ‘hotel’ ‘dietary’ ‘restrictions’ ‘special’ ‘requests’
‘help’ ‘much’ ‘appreciated’ ‘best’ ‘wishes’ ‘amy’ ‘11’ ‘50’ ‘3’ ‘30’ ‘00’
‘0600’ ‘wrote’ ‘amy’ ‘attached’ ‘please’ ‘find’ ‘short’ ‘``’ ‘bio’ ‘``’
‘dr’ ‘kaminski’ ‘please’ ‘let’ ‘know’ ‘help’ ‘see’ ‘attached’ ‘file’
‘vincent’ ‘kaminski’ ‘bio’ ‘doc’ ‘amy’ ‘aldous’ ‘conference’ ‘co’
‘ordinator’ ‘centre’ ‘advanced’ ‘studies’ ‘finance’ ‘university’
‘waterloo’ ‘waterloo’ ‘n’ ‘2’ ‘l’ ‘3’ ‘gl’ ‘tel’ ‘519’ ‘888’ ‘4567’ ‘ext’
‘5728’ ‘fax’ ‘519’ ‘888’ ‘7562’ ‘email’ ‘aaldous’ ‘uwaterloo’ ‘ca’].
Expected: 0.
Got: 1..
Expected:
None,
but got:
1.

Here my screenshots

hi @bmidy23

if you are confident of your codes being correct, then try

Clear/delete kernel output

restart your kernel

re-run each cell individually from beginning till end.

Save your work environment by clicking on the :floppy_disk: save emicon.

Now. submit your assignment.

If you still fail your submission grader, than we need to review your codes for the grade function you are failing

Also check it you are not mixing any local variable recalls with global variable recall.

1 Like

As Deepti says, it is likely that your code does not generalize to the graders’ tests and therefore is not correct. Because the tests inside the running Lab are not the same as those of the grader.

Hi,

first thanks for this quick reply !

impressive, so quick feedback

so I tried all what you told me

still have issue for exercise 4

but not there is no more feedback of the error

so here my issue again:

I also noted that after this exercise, there is more cell that seems to be inaccurate between the text and the expected Cell results,
I mean in the non graded parts after exercise 4

see this 2 screenshots :

May be some isue in the dataset ? or diffrent library versions ?

That surely could be problem but what I am seeing a grader feedback not found error tells the autograder when wanted to grade the naive bayes, couldn’t find markers that detects grade function header or code markers ###START AND END CODE HERE### could be missing or deleted, added or edited anything outside the code markers.

no matter what your accurate output could also be reason.

it is probably time to check your codes, so click on my name and then message me screenshot of the grade function codes you are failing..

Make sure not to post any codes here as it is against code of conduct.

“Grader feedback not found” can also happen if you have modified your notebook in a way that the grader cannot handle.

For example:

  • Adding new cells
  • Deleting cells
  • Moving cells within the notebook.
  • Adding new functions that you created yourself
  • Downloading the notebook, working on it in some other tools (i.e. Colab or VSCode), then uploading it back to Coursera for grading.

These will all cause problems during grading.

Hi

Thanks for this reply

I did reset the lab, after downloading it locally to keep my code

And I did get a new fresh notebook

And then input back my code changes (replace the None with my code)

Re-evaluate all cells one by one

All was like before successfully executed

And all testununits inside the lab successfully exexuted

I also know that adding, but I deleting… and cells could make issues as it is mentioned in the helps/tutorials before you reached/started the lab

1 Like

@bmidy23

while computing p_spam for ham and spam, your codes are incorrect, for both the codes line you need to use class frequency with its respective class(i.e. ham or spam) over total emails.

so you using prob_email_given_spam or prob_email_given_ham to calculate p_spam and p_ham is incorrect.

Also remember in your prob_email_given_spam and ham codes you need to use parameter name=variable name, to avoid local/global variable recall conflict. Notice there is Parameters heading, which has the variable names, so for word_frequency=word_frequency need to followed, instead just mentioning the parameters name)

1 Like

Hi

Thanks you so much

I corrected it and it works now

My fault

1 Like