C2_W1: Regularization- Why do we need to add a None/NULL?

Hi. I am confused as to why to compute backward propagation with regularization, we need to add a None to the equations of dW1,dW2,dW3?

2 Likes

Also, do u have any tips on how to implement this in code? For instance how do we add a None in this equation- dW3 = 1./m * np.dot(dZ3, A2.T) + None?

Hi @shamus,

The exercise says

Implement the changes needed in backward propagation to take into account regularization. The changes only concern dW1, dW2 and dW3. For each, you have to add the regularization term’s gradient.

Since you want to implement the backprop with regularization, you need to add the derivative of the regularization term, to the derivative of current dW1,dW2,dW3. In other words, you have to replace the None with the regularization’s term gradient (ie. last bit of the above quote: Implement the changes needed in backward propagation to take into account regularization. The changes only concern dW1, dW2 and dW3. For each, you have to add the regularization term’s gradient: λ/mW).

Hope that helps,

5 Likes

Hi thanks so much.

Misunderstood the question but I got it now.

Thank you!

Glad I could help!
Cheers,