C2W4 - Grading issue for ex5 only

Hello everyone,

I’m facing grading issues with the last assignment in C2, week4.

All unit tests are passed and moreover even for the grader the ex4-backprop was passed too but for ex5-gradient decent the unit-test and the grader failed.
When take a look into the results all 4 variables, W1,W2,b1 and b2 are affected. Looking to the values it often looks like some rounding issue (Wrong output values for b1 vector. Expected: [[0.32014249]…Got: [[0.32017801]
I’ve searched through other threads as well but did not find any similar problem so far.
For ex5 i think there is almost no hard-coding possible which is a common error.

Can someone give me a hint?
Many thanks in advance!

Hello RoWe84!

In Excercise 5, are you getting the correct and exact same outputs as in Expected Output? I.e.,

iters: 10 cost: 9.686791
iters: 20 cost: 10.297529
iters: 30 cost: 10.051127
...
etc

?

There is a comment underneath stating that " numbers may differ a bit depending on which version of Python you’re using."

I get the exact same answers & the python version is 3.7.6.

Also if you want to cross check, here are the values (partially) of z, h, yhat, and grad_W1 for the first batch when calling gradient_decent from the # test your function cell:

I think this should be sufficient to locate the error if it is there, but if you want I can print out the whole tensors or one more batch etc.

Hope this helps, please let me know if you were able to resolve the issue.

1 Like

Hello Anna_Kay,

Thank you for your reply and your hints.

The Python Version from the notebook is reported as

3.7.6 | packaged by conda-forge | (default, Mar 23 2020, 23:03:20)
[GCC 7.3.0]

The values while training are quite similar but different to the solution

I will check the values with your screenshot and give an update.

Hello Anna_Kay,

checked the values again. Sure, i got different values but in my newby eye’s they are only slightly away from the expected ones. Can’t find any fatal error.
There is no pressure, the assignment is passed anyway but well 100 would be better than 80 :wink:
Can you give me a hint what to check next?

With a known test case, you should get exactly the expected values. Otherwise it means your code has defects.

@RoWe84

When @Anna_Kay shared that screenshot of expected output, what you could have done added #print statement to the values you are getting same match, or add print statement to each step and check when then value starts not match to the Anna’s shared image value, so that would help you debug the incorrect code.

With that being said, please make sure you are working on latest version of the assignment notebook as per the python version and log shared by you. You can check this by clicking on :question:and Log to know if you are working on older version or the latest version with the Update Log option.

Regards
DP

Test your function

w4_unittest.test_gradient_descent(gradient_descent, data, word2Ind, N=10, V=len(word2Ind), num_iters=15)

name default_check
iters: 10 cost: 7.481631
Wrong output values for W1 matrix.


[0.75939134]
[0.60139061]
[0.90836661]].
8 Tests passed
8 Tests failed

Please help.