[Calculus][Lab][# Week3][Weights_Error]Grade Failed but network works well?

Hello Mentors , assistants and everyone in the community :slight_smile:

I had a problem on Week 3 Lab : Neural Network with Two Layers

The model looks good on making right prediction and has a fine decision boundary( as fig1 -3) (ops…newbie could only upload one pic.. Okay i will only leave the decision boundary )

Coordinates (in the columns):
[[2 8 2 8]
 [2 8 8 2]]
Predictions:
[[ True  True False False]]
Expected Output
Coordinates (in the columns):
[[2 8 2 8]
 [2 8 8 2]]
Predictions:
[[ True  True False False]]

But the grade failed on Exercise 3\6\7 which refers to : initialize params\update params\nn model(as fig 4-7)(changed to text description)

======Exercise3: initialize parameters : 8/10=====

Failed test case: “default_check”.
Wrong weights matrix
W1.. Expected: [[ 0.01788628 0.0043651 ] [ 0.00096497 -0.01863493]],
but got: [[0.00550798 0.00708148] [0.00290905 0.00510828]].

Failed test case: “default_check”.
Wrong weights matrix W2..
Expected: [[-0.00277388 -0.00354759]],
but got: [[0.00892947 0.00896293]].

======Exercise6: update parameters :10/20=====

Failed test case: “default_check”.
Wrong array W1..
Expected: [[ 0.01790426 0.00434497] [ 0.00099046 -0.0186642 ]],
but got: [[ 0.01790127 0.00434832] [ 0.00098621 -0.01865932]].

======Exercise7: nn_model :10/20=====

Failed test case: “default_check”.
Wrong weights matrix W1..
Expected: [[ 2.53492212 -2.06302136] [ 2.06885671 -1.96083822]],
but got: [[-2.3118913 1.66062595] [-1.86405184 1.78666822]].

And i checked the code, seems not much things i could do with? :frowning:
Here are some efforts i made:

  • Change the random seed from 3 to others(such as 4\33..etc)
  • multiply different number such as 1\0.15\0.01 to initial weights
  • add iter numbers from 3000 to 6000….
  • check if i wrongly forgot to add bias?( But i did add)
  • undo all unnecessary change especially those without CODE HERE marks

But my maximum score is still 78/100 TvT, I tried and graded again and again, Could anyone help with that ? I would be very grateful!!

plus: Lab ID : vqaxksunikuz

Do not change the random seed.
Do not change the initial weights.
Do not change the number of iterations.

Instead, look for errors in your code.

1 Like

Yeah… finally i undo all changes, iter = 3000(default),no extra multiply on weights ,and random seeds = 3,
But still fine decision edge, prediction test passed , but grader tell me wrong weights…TvT

Or….is there a way to clear all changes on the lab and return it to the initial state? I would like to do it again from the begining

To start over with a clean notebook:

Use the File menu and rename your notebook.

Use the Lab Help tool and use “Get latest version”. This will give you a new copy of the notebook.

Then exit the lab and re-enter it.

1 Like

Thank you so much! I will go to have a try :smiley:

This time 100%! Thanks a lot!
Some problem i may made mistake in previous lab:

  1. weight should only multiply 0.01 as text instructed.
    2.in nn_model exercise ,dont copy learning_rate = 1.2 when calling the function
1 Like

Nice work!

Had literally the same issue and grade was around 88%.
Initially thought - something wrong with a grade system like it tried to check random initial variables in initialize_parameters function and got wrong.
But after reading this thread and @JiaryAI success

I found 2 errors in my code:

  1. np.random.randn() instead of np.random.rand() - ‘n‘ at the end
  2. did not pass learning_rate in update_parameters function inside the nn_model function

And got 100%

1 Like