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?
Probably you may have not saved your work before submission. Try applying the following steps mentioned below:
Save your work and then try submitting your work.
If that’s not the case then, close that browser, launch your notebook again and follow the same step as 1.
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
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
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.
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.
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!