pyod icon indicating copy to clipboard operation
pyod copied to clipboard

HBOS negative scores

Open nacheteam opened this issue 4 years ago • 2 comments

Hello,

I have been reading the paper Histogram-Base Outlier Score and testing a little bit with the implementation of this python module. By looking at the paper we can see that the minimum score that we can have is 0 by the normalization and logarithm in the formula but when I try it with the PyOD module I get some negative scores.

  • We can still apply the rule "the bigger the score the more anomalous the instance is"?
  • Why are we getting these negative values?

Thanks in advance to any reply.

nacheteam avatar Oct 22 '20 08:10 nacheteam

I have seen the same problem and even with other algorithms, such as IForest and OCSVM

martagb avatar Oct 23 '20 08:10 martagb

it seems that (at least for IForest), the calculated score is shifted with offset. Probably you can undo such offset for IForest to shift the score range back to 0-1, like

iforest.decision_scores_ - iforest.detector_.offset_

lujiazho avatar Jun 21 '23 23:06 lujiazho