C3_W1_Anomaly_Detection Select Threshold Function

I finished the select_threshold() function and it passed the unit test within the notebook.

However, when I submit my assignment, I am receiving the following error:

Code Cell UNQ_C2: Unexpected error (ValueError('The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()')) occurred during function check. We expected function `select_threshold` to return type <class 'bool'>. Please check that this function is defined properly. 
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.

this error is very confusing because

  1. I don’t understand where my valueerror is arising from
  2. the select_threshold() function is supposed to return epsilon and F1 which are both floats so I don’t know why the error is saying that the function is saying that the function is supposed to return a boolean.

Thanks in advance

Your code is returning a vector (or list) when it should be a scalar.

Passing the tests in the notebook does not mean your code is perfect.

1 Like

I see, thanks alot! Figured out that my issue what that I was returning a numpy.float rather than a float :))