# W3 | Planar Data Classification | Backprop wrong dW1

**URL:** <https://community.deeplearning.ai/t/w3-planar-data-classification-backprop-wrong-dw1/210537>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [September 26, 2022, 3:30pm UTC](https://community.deeplearning.ai/t/w3-planar-data-classification-backprop-wrong-dw1/210537 "2022-09-26T15:30:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Brown](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Matthew\_Brown](https://community.deeplearning.ai/u/Matthew_Brown)\
**Post date:** [September 26, 2022, 3:31pm UTC](https://community.deeplearning.ai/t/w3-planar-data-classification-backprop-wrong-dw1/210537/1 "2022-09-26T15:31:00Z")

</div>

Hello,

I get a very small variation from the expected output, namely:  
dW1[2,1], dW1[2,2] and db1[2,1]

## // Full error message

AssertionError Traceback (most recent call last)  
 in   
7 print ("db2 = "+ str(grads[“db2”]))  
8  
----\> 9 backward\_propagation\_test(backward\_propagation)

~/work/release/W3A1/public\_tests.py in backward\_propagation\_test(target)  
187 assert output[“db2”].shape == expected\_output[“db2”].shape, f"Wrong shape for db2."  
188  
 → 189 assert np.allclose(output[“dW1”], expected\_output[“dW1”]), “Wrong values for dW1”  
190 assert np.allclose(output[“db1”], expected\_output[“db1”]), “Wrong values for db1”  
191 assert np.allclose(output[“dW2”], expected\_output[“dW2”]), “Wrong values for dW2”

AssertionError: Wrong values for dW1

//My output  
dW1 = [[0.00301023 -0.00747267]  
[0.00257967 -0.00641287]  
[-0.00156892 0.003893]  
[-0.00652037 0.01618243]]  
db1 = [[0.00176201]  
[0.00150994]  
[-0.00091736]  
[-0.00381422]]  
dW2 = [[0.00078841 0.01765429 -0.00084166 -0.01022527]]  
db2 = [[-0.16655712]]

//Expected

```auto
dW1 = [[0.00301023 -0.00747267]
 [0.00257968 -0.00641288]
 [-0.00156892 0.003893]
 [-0.00652037 0.01618243]]
db1 = [[0.00176201]
 [0.00150995]
 [-0.00091736]
 [-0.00381422]]
dW2 = [[0.00078841 0.01765429 -0.00084166 -0.01022527]]
db2 = [[-0.16655712]]

```

_{Moderator’s Edit: Solution Code Removed}_

Thanks!

---

<div class="post-metadata">

**Author:** ![Elemento](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/elemento/32/854_2.png) [@Elemento](https://community.deeplearning.ai/u/Elemento)\
**Post date:** [September 27, 2022, 9:49am UTC](https://community.deeplearning.ai/t/w3-planar-data-classification-backprop-wrong-dw1/210537/2 "2022-09-27T09:49:18Z")

</div>

Hey @Matthew_Brown,  
Welcome to the community. Please check the expression of `dZ1` carefully. When you are calculating `dZ1`, we are considering the expression dZ1 = da1 \* \frac{\partial{a1}}{\partial{Z1}} where \frac{\partial{a1}}{\partial{Z1}} is supposed to be `(1 - np.power(A1, 2))` as pointed out in the tips. Let me know if this helps.

**P.S. - Posting code publicly is strictly against the community guidelines. Please refrain from doing so in the future. If a mentor needs to take a look at your code, (s)he will ask you to DM it.**

Cheers,  
Elemento
