Assertion error: C3_W1_Anomaly_Detection

In the first week’s lab on anomaly detection (exercise 2), I have tried both loop and vectorised implementation to find the most appropriate epsilon. I keep getting an assertion error even if I simply copy paste the code from hints:

Wrong best_epsilon. Expected: 0.04 got: 0.28971

Any chance the assertion could be wrong?


Can you send me your code so I can take a look?

I have completed the code with loop implementation. Can you provide some hint to do a vectorised implementation.
np.sum(np.logical_and(pred_labels == 1, true_labels == 1)) - is this a correct vectorised implementation?

You do not need to use np.logical_and(). The regular Python logical operator ‘&’ is sufficient.

However I don’t know of any reason why np.logical_and() would not work. I’ve never tried that way.