C2_W3_Assignment Unit Test Excercise 2

Hi,

In the excercise 2, i dont understand why i can’t pass the unit test because my code does all unit test well if i test manually, i did’t use loops in my function, as follows:

{code removed by mentor}

And i have the follow error in the unit test:

AssertionError                            Traceback (most recent call last)
<ipython-input-21-d6d753fbbaf5> in <module>
      7 
      8 # BEGIN UNIT TEST
----> 9 test_eval_cat_err(eval_cat_err)

~/work/public_tests_a1.py in test_eval_cat_err(target)
     46     y_tmp = np.array([1, 1, 1, 0, 0, 0])
     47     result = target(y_hat, y_tmp)
---> 48     assert np.isclose(result, 3./6., atol=1e-6), f"Wrong value. Expected 0.5, but got {result}"
     49 
     50     y_hat = np.array([[1], [2], [0], [3]])

AssertionError: Wrong value. Expected 0.5, but got [0.17]

I want to understand, why my function is wrong.

thanks!!

Hello @Daniel_Mendoza_Castr,

You haven’t used the y given to the function in calculating the error value. Mind the variable name :wink:

Raymond
PS: I am removing the assignment code for you because we can’t share that here. Posting the Error Traceback (as you also did) is sufficient as the first step.

1 Like