Need help with week 2 assignment 2

I am getting Assertion error on model_test() function, rest of the code is working perfectly fine, I have checked the code three time and couldn’t found out what is wrong.

Any help would be appreciated. :pray:

How to find the gradient of weight i.e. dw

dw =, (A - Y).T) / m

Is this correct ?

That is the correct formula for dw. The test error is telling you that the w value your code generates is incorrect. If all your other routines pass their tests, this type of problem usually means your model function is not passing the correct parameters to optimize. E.g. perhaps you are “hard-coding” some of the parameters, instead of passing through the values that were passed into model at the top level.

I’m also facing a similar problem, all the previous tests have passed but the final merged model does not pass the test, kindly help I’ve been trying to debug for a long time but in vain.

@Prasannab Your error is typically caused by not passing the learning rate and number of iterations on the call to optimize from model. You need to pass all the arguments to optimize.

1 Like