Week 4 assignment 2 - 2 layer model


I finished my 2 layer model but got the following error message:

Error: Datatype mismatch. in variable 0. Got type: <class ‘numpy.float64’> but expected type <class ‘numpy.ndarray’>

My results seem to be right and I can implement the model. Do you know how I can fix the data type issue? I am also happy to post my code if needed.

Thanks for your help, I appreciate it!

1 Like

Are you sure that you didn’t “hand import” your functions from the “Step by Step” exercise (C1 W4 A1) here? Note that they do not ask you to do that, because they supply their own “known correct” implementations. Their cost function returns a 1 x 1 array, but in the Step by Step exercise, they also accepted a scalar float as the cost.