Logistic Regression with a Neural Network mindset - exercise 5

Good afternoon, I have been trying to do the exercise 5 but I am not able to… actually I get an error with the float64 of the variable but that is not only the problem… also the numbers do not fit with the solution. Can you see what I’m doing wrong and why?
thank you very much!

My code is:

{moderator edit - solution code removed}

Why are you writing out the implementation of the sigmoid function again here? That is not the problem, but you already wrote that function, right? Why not just call it?

Also why use A.shape[1] everywhere? They already gave you the code in the template to set m to the value you need there.

Also note that you have the formula for the cost wrong: your value will end up being negative. Check the formula again.

Note that A - Y has dimension 1 x m, so why are you summing on axis = 0? You just want a scalar value in any case, since b is a scalar.