W2_A2_Failing Test on a hidden cell

How can I see the corrected version of my assignment once I received my score in order to understand my mistakes ?
The “Grader Output” doesn’t seem very explicit e.g “Tests failed on 1 cell(s)! These tests could be hidden. Please check your submission.” is mentioned for my “Practice Programming Assignment” of Week 2.
Thanks in advance

Hi @Didier_Heck ,

Before submitting your assignment, could you do the following from the top of the menu bar:

  1. from the kernel tab, click restart & clear all output
  2. from the cell tab, click run all
  3. checking there is no error before hitting the submit button
1 Like

Hi Kic,
Just did what you said.
Only cell 6 is in error because it’s an example why we don’t use math but numpy instead.

But I only had 88% to my assignment.



Hi @Didier_Heck ,

math.exp() only works on scalar values. But np.exp() can operate on array of values. So when passing an array to math.exp(), it would raise an error as reported here.

Unfortunately the grader sometimes can’t tell us which function is the one that failed the tests. We have asked the course staff about this a number of times and it’s apparently not easy to fix. One experiment to try would be to comment out the call to basic_sigmoid with the array input which is failing and then “Save” and “Submit” again. My guess is that will still not help, because there is probably a real error someplace else.

If we can’t get any better information from the grader in a case like this we may have to examine your code ourselves. There are no “official solutions” or any way for the grader to show you the correct answers. I will send you a DM about how to proceed with that.

Hi @Didier_Heck ,

When you click the cell tab → run all, the kernel would stop at cell 6 because of using math.exp() with x, a vector, as input argument. You need to run the rest of the code cells to the end of the assignment. The grader would not take into account of cell 6 as this is designed for you to see the difference between math.exp() and np.exp().
I have just rerun my code and submitted it without any issue and got 100% of the marks.

Thanks Kic,

But this doesn’t tell me why I received 88% as this cell was not an exercise but just an explanation identical to the one you gave here under!

To close the loop on the public thread, we had a DM conversation to examine the source code and the problem turned out to be a “hard-coding” error in the softmax function that assumed that the input matrix would always have 2 rows. It worked in the notebook test, but failed the grader. The “take away” point here is that it’s always a mistake to hard-code any assumptions about the inputs unless you literally have no choice and they specifically tell you to do that.

Of course it’s still a question why the grader couldn’t be bothered to tell us which function was wrong, but (as I mentioned earlier) that will just have to remain a mystery. The only good news is that there is a way to proceed when you get hit with that conundrum.