Hello mentors and fellow students:

I am stuck at the exercise to try to write an optimize function. It looks like the error occurred from previously written function, but I have passed previous exercises. It looks like perhaps w’s shape is wrong. When I checked w’s shape it says:
It looks different from the shape mentioned in the error message.

my spidey sense says b is the problem

can you do this right before the call to optimize()?


I get

(2, 1)
<class ‘float’>

Guessing your b is not a float.

Exactly. I’ll bet that b is actually a numpy array instead of a scalar float. We’ve seen this error before and it’s usually caused by incorrect logic in the “update parameters” section of the algorithm. E.g. using dw to update b.

@ai_curious and @paulinpaloalto Thank you for the advice. I have passed this test now!

1 Like