# Week 3 programming assignment exercise 7 wrong value error

**URL:** <https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [August 26, 2023, 6:45pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991 "2023-08-26T18:45:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahraz\_Athar](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@Ahraz\_Athar](https://community.deeplearning.ai/u/Ahraz_Athar)\
**Post date:** [August 26, 2023, 6:45pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/1 "2023-08-26T18:45:35Z")

</div>

Hello I am getting an error in week 3 Assignment and in exercise 7  
It says wrong value of W1  
does it have something to do with copy.deepcopy for W1 and W2?  
I have used correct formula for updating W1,W2,b1 and b2 but still I am getting this error  
Someone please help

 ![12](https://global.discourse-cdn.com/dlai/original/3X/6/e/6e3b1167901994fe37924506ffa79b314e9b3a07.png)  
 ![11](https://global.discourse-cdn.com/dlai/original/3X/6/1/61c8967e7c3ea69aca8018d508abb4f77f5c32ab.jpeg)

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [August 26, 2023, 7:46pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/2 "2023-08-26T19:46:55Z")

</div>

Here are my results from that test cell:

```auto
W1 = [[-0.00643025 0.01936718]
 [-0.02410458 0.03978052]
 [-0.01653973 -0.02096177]
 [0.01046864 -0.05990141]]
b1 = [[-1.02420756e-06]
 [1.27373948e-05]
 [8.32996807e-07]
 [-3.20136836e-06]]
W2 = [[-0.01041081 -0.04463285 0.01758031 0.04747113]]
b2 = [[0.00010457]]
All tests passed!

```

Notice that yours differ in most cases in the 4th or smaller decimal places. That must mean there is something different about your code. Are you sure you didn’t use a different value of \alpha (the learning rate)?

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [August 26, 2023, 7:48pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/3 "2023-08-26T19:48:35Z")

</div>

Actually, that is exactly the problem: you changed the template code. Here’s what the definition of that function is in my notebook:

```auto
# GRADED FUNCTION: update_parameters

def update_parameters(parameters, grads, learning_rate = 1.2):

```

So why did you change the default value of the learning rate to be 1.5, when the value they gave you was 1.2? This is a problem because the test cases actually do not pass that value, so the default is the one that is actually used in both test cases (the one you can see and the one in the file `public_tests.py`).

It’s never a good idea to modify the parts of the logic outside the “YOUR CODE HERE” sections. It’s not against the rules, but you need to be sure that you know what you’re doing when you “go there”.

---

<div class="post-metadata">

**Author:** ![Ahraz\_Athar](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@Ahraz\_Athar](https://community.deeplearning.ai/u/Ahraz_Athar)\
**Post date:** [August 27, 2023, 12:49pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/4 "2023-08-27T12:49:10Z")

</div>

Thanks for the prompt reply. So I don’t know why but in my notebook the value of learning rate was already set to 1.5  
It was late in night yesterday in this part of the world so i posted the question and went to sleep thinking that may be someone is gonna reply or not and with a will to sort it out myself the next day. So today early morning i googled the exact same query and found a page where learning rate was mentioned as 1.2  
[https://kawshikbuet17.github.io/Coursera-Deep-Learning/01-Neural-Networks-and-Deep-Learning/Codes/Week%203/Planar%20data%20classification%20with%20one%20hidden%20layer/Planar\_data\_classification\_with\_onehidden\_layer\_v6c.html](https://kawshikbuet17.github.io/Coursera-Deep-Learning/01-Neural-Networks-and-Deep-Learning/Codes/Week%203/Planar%20data%20classification%20with%20one%20hidden%20layer/Planar_data_classification_with_onehidden_layer_v6c.html)

I changed and then it passed all the tests and have even completed the assignment  
Thanks for the response and now i can be rest assured that my queries will be answered.  
Cheers

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [August 27, 2023, 2:56pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/5 "2023-08-27T14:56:13Z")

</div>

Please note that if you are finding solutions on the internet, that there have been a number of versions of these various notebooks, so you can’t just assume that any one you find will work with the current state of the assignment. In particular that one with \_v6c in the name is an old one. But that particular point about the default value of the learning rate does happen to be connect.

If you are actually using solutions you find on the internet, also note that is a violation of the rules here, in addition to not being reliable if the notebook you find is not current or not correct (in the case of the erroneous 1.5 value).

---

<div class="post-metadata">

**Author:** ![Ahraz\_Athar](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@Ahraz\_Athar](https://community.deeplearning.ai/u/Ahraz_Athar)\
**Post date:** [August 27, 2023, 3:43pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/6 "2023-08-27T15:43:26Z")

</div>

I Just used the learning rate value.  
Nothing else.  
That too because I didn’t know that my notebook was showing wrong value.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [August 27, 2023, 3:56pm UTC](https://community.deeplearning.ai/t/week-3-programming-assignment-exercise-7-wrong-value-error/428991/7 "2023-08-27T15:56:17Z")

</div>

And you didn’t get your original notebook from someplace other than the course website? Because I checked and the learning rate is 1.2 in the clean notebook from the course. So if you got your notebook from the course, then you must have made that change. Maybe you don’t remember doing that, but there is no other explanation that I can think of. Notice that the formatting is different as well: no spaces around the equal sign and a space after the value. My post shows how it looks in the “clean” course notebook.
