Closed andrewclegg closed 9 years ago
Sounds like a bug to me! Owen and I are looking into this tonight and we'll issue a patch, thanks again and nice detective work.
Hi Andrew,
Thanks for the heads up. We now set R_idx to NULL if there are 0 anoms detected.
Thanks for the quick response!
Cheers!
I think I've found a bug in
detect_anoms
.Before the main loop,
num_anoms
is initialized to 0.At the end of each iteration, you update
num_anoms
if R is greater than lambda.Then after the loop, you return
R_idx[1L:num_anoms]
.So if no elements made R exceed lambda, the return value works out to
R_idx[1L:0L]
. But this range subscript gives you the first element, not an empty vector:So won't it always report the most extreme value as an outlier, no matter what data you give it? (Of course the user won't see this if they've set a threshold in
AnomalyDetection
, but they might not do that...)