Week2 Logistic Regression Programming Assignment

I’m getting correct values in the beginning
but getting inf after 19 interations for computing the cost
for propagate(b, w, X, Y).

Is there anything wrong with the code?

{mentor edit: code removed}

Your code seems correct to me. Have you passed the Exercise 3 - sigmoid?

@chang11, in the future please do not share your code on the forum. That is not allowed by the Code of Conduct.

If a mentor needs to see your code, we’ll contact you with instructions.

Which test is actually throwing the error? Please show us the error you get. If you are iterating over propagate, my guess is that the problem is in your optimize logic, not in propagate. Take a careful look at how you handle the “update parameters” logic in optimize. E.g. are you adding the gradient values instead of subtracting them? Or not multiplying by the learning rate? Please compare your code to the mathematical formulas shown in the instructions.

1 Like

Ah yes!, I was adding dw, instead of subtracting it, thank you so much!

1 Like