W2 Assignment Exercise 8

I am getting the following assertion error:

AssertionError: Wrong length for d['costs']. 20 != 1

However, I don’t understand how the length of d[‘costs’] could actually be 1. In optimize(), the code automatically appends the cost ever 100 iterations, and in model_test() the number of iterations is 2000. Therefore it makes sense that the length of d['costs] should be 20. Why is the code expecting it to be 1?

Sorry for the post. My question was answered in a previous one.

In model_test the number of iterations is set to 50, you can check it by printing the d dictionary. Someone else has solved this issue by removing the default values in optimize function.

1 Like