I can’t figure out what the error msgs are trying to tell me:

If you get stuck, you can check out the hints presented after the cell below to help you with the implementation.

In [31]:

# UNQ_C4

# GRADED FUNCTION: predict

*mentor edit: code removed*

Click for hints

Once you have completed the function predict, let’s run the code below to report the training accuracy of your classifier by computing the percentage of examples it got correct.

In [32]:

# Test your predict code

np.random.seed(1)

tmp_w = np.random.randn(2)

tmp_b = 0.3

tmp_X = np.random.randn(4, 2) - 0.5

tmp_p = predict(tmp_X, tmp_w, tmp_b)

print(f’Output of predict: shape {tmp_p.shape}, value {tmp_p}')

# UNIT TESTS

##
predict_test(predict)

Output of predict: shape (4,), value [1. 1. 1. 1.]

AssertionError Traceback (most recent call last)

in

9

10 # UNIT TESTS

—> 11 predict_test(predict)

~/work/public_tests.py in predict_test(target)

78 expected_2 = [0., 0., 0., 1., 1., 0.]

79 assert result.shape == (len(X),), f"Wrong length. Expected : {(len(X),)} got: {result.shape}"

—> 80 assert np.allclose(result,expected_2), f"Wrong output: Expected : {expected_2} got: {result}"

81

82 print(‘\033[92mAll tests passed!’)

AssertionError: Wrong output: Expected : [0.0, 0.0, 0.0, 1.0, 1.0, 0.0] got: [0. 0. 0. 0. 1. 0.]

Expected output

Output of predict: shape (4,),value [0. 1. 1. 1.]