C2_W3_Assignment Exercise 7

I completed the assignment with top marks in all exercises but I got 15/20 in exercise 7. The error indicates:

Failed test case: “extra_check”. Wrong weights matrix W1…
Expected:
[[-0.05350702 -0.10250995]
[-0.07303197 -0.1295294 ]
[-0.07487082 -0.11145172]],
but got:
[[-0.88792757 -2.15678679]
[-0.90083658 -2.29294507]
[-0.90485966 -2.2175348 ]].

Failed test case: “extra_check”. Wrong bias vector b1…
Expected:
[[0.03448384]
[0.03609865]
[0.0347455 ]],
but got:
[[0.79242606]
[0.92205182]
[0.85903016]].

Failed test case: “extra_check”. Wrong weights matrix W2…
Expected:
[[-0.39306094 -0.41154116 -0.40031599]],
but got:
[[-2.53898163 -2.75359949 -2.64586636]].

Failed test case: “extra_check”. Wrong bias vector b2…
Expected:
[[-0.74585916]],
but got:
[[1.72524631]].

I already went through all my code and wasn’t able to find what was wrong. I would like to send my code to someone to be pointed in the right direction.

Thank you all.

Check if you have updated both your notebook and the python utility files.

1 Like

Thank you for your prompt reply. How can I update my notebook and utility files without losing my work? Thanks again.

Use the Files menu and rename your notebook. Then when you use Help → Get latest version, you’ll have both the new notebook, and your previous copy.

Then you can open both notebooks and copy your code segments into the new notebook.

1 Like

Wow, man! You are glued to your computer! :grinning: Thank you so much for being available so fast. Is there a way inside Coursera to open the old and the new notebooks side by side? Should I use something like google colab? Thank you mate.

I recommend you open two separate browser windows, and open each notebook in one of them. Then set them up as side-by-side browser tabs, so you can see both at the same time.

1 Like

Done. Same result. Bias and weights different from expected outputs:

Cost after iteration 2999: 0.189669
W1 = [[ 2.08801776 -1.89503493]
[ 2.46515642 -2.07480543]]
b1 = [[-4.84976773]
[ 6.30623075]]
W2 = [[-7.20236323 7.07357254]]
b2 = [[-3.45260284]]

But after submitting I got top marks! Thank you immensely! But why o why did my bias and weights are different from the expected outputs?

Did you also update your w3_unittest.py file?

1 Like

Not sure. Not under the full scope of my conscience. :blush: But it sure did work! Much obliged mate! Full 100% when once it was a mere 95% :clap:

Go to the Files menu.
Delete w3_unittest.py
Then go back to the Help menu, and “Get latest version”. That will update any missing files.

Both the notebook and the w3_unittest.py file and the grader were all updated three weeks ago.

1 Like

The w3_unittest.py file on my notebook is from 9/11/2023. I believe it to be the new one, isn’t it?

Open the file and look starting at line 345.
If it looks like this, it’s the current version.
image

Thank you for your thoroughness. The file is indeed the current one. The lines of code you mentioned are exactly the same as the ones I see in my file w3_unittest.py. Do you believe that I made some error in my code so that there’s a difference in the results I got? I wonder if the cost function is wrong. Perhaps the use of .dot instead of matmul in the back prop is propagating an error?

I recommend you try both and compare the results.