W2_A2_Ex-8_Wrong values for d[‘Y_prediction_test’]

I couldn’t find a solution for my problem, so I am posting this.
Every other exercise is completed successfully.

Here is my traceback:

AssertionError Traceback (most recent call last)
in
1 from public_tests import *
2
----> 3 model_test(model)

~/work/release/W2A2/public_tests.py in model_test(target)
137 assert type(d[‘Y_prediction_test’]) == np.ndarray, f"Wrong type for d[‘Y_prediction_test’]. {type(d[‘Y_prediction_test’])} != np.ndarray"
138 assert d[‘Y_prediction_test’].shape == (1, x_test.shape[1]), f"Wrong shape for d[‘Y_prediction_test’]. {d[‘Y_prediction_test’].shape} != {(1, x_test.shape[1])}"
→ 139 assert np.allclose(d[‘Y_prediction_test’], expected_output[‘Y_prediction_test’]), f"Wrong values for d[‘Y_prediction_test’]. {d[‘Y_prediction_test’]} != {expected_output[‘Y_prediction_test’]}"
140
141 assert type(d[‘Y_prediction_train’]) == np.ndarray, f"Wrong type for d[‘Y_prediction_train’]. {type(d[‘Y_prediction_train’])} != np.ndarray"

AssertionError: Wrong values for d[‘Y_prediction_test’]. [[1. 0. 0.]] != [[1. 1. 0.]]

Thanks.

It looks like your predict function is wrong, but it wasn’t caught by the test cases. Please check the index value that you used in the “negative” case: are you sure it’s i and not 1? Or there may be some other problem with the predict logic.