Week 4, Course 1, Assignment 2

I am getting this error and I am unable to figure out where this float value is that is supposed to be a numpy array. i have been using the type() function to check values and all seems correct. the cost is supposed to be a float value right? i was thinking the error is coming from update paramenters but im not 100% sure. any help is much appreciated.

The first thing to point out is that you should not be copying over your code from the Step by Step exercise here. They already import that for you. So the cost is whatever compute_cost returns and should be “out of your hands” at this point, right? And it turns out that it is a numpy array with one element.

I checked and in the Step by Step exercise, it accepts either a float or 1 element array for cost, but here they are assuming you did not just port over your own code and the code they provide uses np.dot instead of np.sum, so you get an array. It doesn’t really fundamentally matter, so you could argue that failing for that type is overkill. But if you just use the code they provided you, it all works.