C1_W3_Logistic_Regression/ Regularization

Hi Guys hope you all doing good,
I am stuck at this point. Why should dj_dw be in for loop? If it’s in our for loop we calculate it j time but in the formula, we sum WJ and add one-time lambd/m. Like what we do with f_wb= w*x + b
Thank you for your answer.

Hello @Mikaeil,

dj_dw doesn’t have to be in a for loop. dj_dw is an numpy array, so we have the freedom to update each element one by one using a loop, or all at a time by operating it with another numpy array of the same size. It’s your choice and the later way is more efficient.

Cheers,
Raymond

PS: We can’t share assignment code here so I am removing them.