Week 2, assignment 2, Exercise 8 -model

I’m getting this error:

AssertionError                            Traceback (most recent call last)
<ipython-input-133-7f17a31b22cb> in <module>
----> 1 model_test(model)

~/work/release/W2A2/public_tests.py in model_test(target)
    113     assert type(d['costs']) == list, f"Wrong type for d['costs']. {type(d['costs'])} != list"
--> 114     assert len(d['costs']) == 1, f"Wrong length for d['costs']. {len(d['costs'])} != 1"
    115     assert np.allclose(d['costs'], expected_output['costs']), f"Wrong values for pred. {d['costs']} != {expected_output['costs']}"

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

Please let me know how I can resolve this error.

This helped :slight_smile:

I have the same problem and unfortunately I am not finding the answer in this thread. I’m sorry if I’m being dense about how to use the forum but I have tried clicking on “post #3” and that did not lead me to an answer. Thank you.

@michael.brent Click on the line that is in blue in the reply from Gourav289 just above or in the Post #3 that you referred to. Links are highlighted in blue in Discourse posts.

Thanks, that resolved my issue, too. I had copy-pasted the optional arguments from the top of “model” down and forgot to delete the default values.

1 Like

Glad to hear that you found the solution! Thanks for confirming.