[Course 1, Week 3] Code is correct, grader gives 0 points

Hello,

I am unsure about whether or not I passed my coding assignment from week 3.
The tests within the jupyter notebook all pass but when I submit the assignment, the kernel seems to crash.
I submitted four times - three times I failed, one time I passed.
You can see the logs in the screenshot below.
When I just go on to the next week, the green check mark will not appear.
What do I do now?

Thank you in advance,
Ricarda

Hi Ricarda,

Probably you may have not saved your work before submission. Try applying the following steps mentioned below:

  1. Save your work and then try submitting your work.

  2. If that’s not the case then, close that browser, launch your notebook again and follow the same step as 1.

  3. If that’s not the case again, then restart the kernel and clear all outputs, save your work–> then run all the cells from the beginning till end through shift+enter key–> save it and then submit it.

Hopefully, any of these steps might save your time and your hardwork :slight_smile:

Hi @Rashmi,

I’m having a similar issue, except my grader output is 88/100.

  • All tests have passed
  • I’ve tried following the process you described above
  • I’ve checked for any hard-coded values in the exercises which could upset the grader
  • I’ve confirmed that none of my code uses “in-place” arithmetic, e.g. ‘-=’

My grader output remains the same:

Could you help me, please?

Regards,
Andrew

Hi Andrew,

Welcome to the community!

If that’s the case, probably you are using some hard-coded values within the function. This might pass all the tests in your assignment, but would eventually throw errors in the autograder part and so, it won’t give the desired output. Please look for any hard-coded values, in case you have used. Do away with that and certainly you will achieve the score :slight_smile:

Just to close the loop here, the problem turns out to be using A2.shape in compute_cost to compute the value of m (the number of samples) that is used in the cost computation. They give you the logic in the template to compute m based on the shape of Y. It’s not immediately obvious why the grader doesn’t like this, but that turns out to be the case.

Thank you @paulinpaloalto and @Rashmi for your help.

Hi Rashimi,

Sorry for the late answer.
I tried the steps you proposed, but I kept receiving the same error messages.
However, the assignment now has the green tick and I could continue in the curriculum.
Thank you for your help.

Have a nice day,
Ricarda

Hi Ricarda,

Yet, you didn’t receive the full marks, right? We will look through that. Let me get through DLAI team and check what’s the actual reason!

In the meantime, continue with your other sessions!

Good luck and Keep Learning!

It is unfortunate that the grader output is not helpful in this case. One problem I encountered on this assignment is that the grader seems very sensitive to any added cells. I added a new cell early in the notebook to print the ratio of red to blue samples like this:

numRed = np.sum(Y == 0)
numBlue = np.sum(Y == 1)
print(f"{numRed} red samples, {numBlue} blue samples")
print(f"{numRed/m} red fraction, {numBlue/m} blue fraction")

And just that added cell that doesn’t create any variable names that conflict with the rest of the notebook was enough to cause the same result you show: It says my notebook passed all the tests, but gives 0/100 as the score.

So one thing to check is to make sure you did not added any additional cells to the notebook. Also please check your DMs!