Week 2, exercise 8, cost is not the correct shape

solved

when I run the test for exercise 8. I get the error:

Wrong length for d[‘costs’]. 20 != 1

However the code for optimize is as follows

if i % 100 == 0:
costs.append(cost)

        # Print the cost every 100 training iterations
        if print_cost:
            print ("Cost after iteration %i: %f" %(i, cost))

therefore, given that we are passing the parameters:

num_iterations=2000, learning_rate=0.5, print_cost=False

2000/100 = 20 which is the length of the list of costs.

What is the issue here?

its because I hard coded the parameters of optimize

Please see this thread.

Hope this helps.