Course 2 Week 4 Assignment Ex 05 Gradient Descent

Hello,
I can’t seem to get the gradient descent function to work, even though all the other tests have passed.
I use the formula:

W1 = W1 - (alpha * grad_W1)
W2 = W2 - (alpha * grad_W2)
b1 = b1 - (alpha * grad_b1)
b2 = b2 - (alpha * grad_b2)

Is this correct?

2 Likes

@Reghu Do you mean that the w4_unittest.test_gradient_descent in cell #23 is failing?

I also had this problem on week 4. I used the same formula, and had deviations of less than about .001, so I wasn’t sure if I was using the seed wrong somewhere or something like that. I noticed in the comment that it mentions a small deviation should be permitted, but looking through the unittests, it doesn’t look like this tolerance is added in… that being said, with the random_seed being set, I think that exactness shouldn’t be a problem, I’m just not sure what the issue is after having confirmed that all other unittests for all of the supporting functions pass (presumably verifying that my gradient computations are right).

Did anyone ever find a solution for this?

In my case there was a problem in previous function, back_prop, which passed the test but was wrong and that’s why i was getting wrong result for this one.

Hey Snapikk, can you explain what was wrong in your implementation. My deviations are even small 0.001 off but back_prop tests are passing.