The error i get in ex 8
I do not understand why costs is an array of 20 arrays. When I print it it returns instead of a single value, a value of several arrays. See below
AssertionError Traceback (most recent call last)
in
----> 1 model_test(model)
~/work/release/W2A2/public_tests.py in model_test(target)
112
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’]}"
116
AssertionError: Wrong length for d[‘costs’]. 20 != 1
print(costs)
[array(0.69314718), array(0.03844515), array(0.01922401), array(0.012763), array(0.00954021), array(0.00761264), array(0.00633123), array(0.00541815), array(0.00473474), array(0.00420412), array(0.00378026), array(0.00343392), array(0.00314563), array(0.00290194), array(0.00269325), array(0.00251253), array(0.00235451), array(0.00221517), array(0.0020914), array(0.00198071)]
All cells are validated and I passed the exercise, but not with 100/100 and I am curious why I get this error. Tried debugging it myself and did not figure out why. The optimize exercise returns the correct value.