Giter Site home page Giter Site logo

Comments (3)

Callidior avatar Callidior commented on June 9, 2024

Hi!

Since maxdiv_score_intervals is a fairly new function, I cannot rule out possible bugs right away. However, it is totally possible for cross-entropy to become negative. Only the KL divergence is guaranteed to be strictly non-negative. Cross-entropy on continuous distributions (as opposed to discrete distributions) can actually become negative.

In any case, maxdiv_score_intervals should give identical scores to the ones returned from maxdiv/maxdiv_exec when using the same distribution. Could you try to re-score the detected intervals with the same method used by the detector (both for the ID and the full distribution) and confirm that the scores are the same?

from libmaxdiv.

Smu-Tan avatar Smu-Tan commented on June 9, 2024

Hi!

Since maxdiv_score_intervals is a fairly new function, I cannot rule out possible bugs right away. However, it is totally possible for cross-entropy to become negative. Only the KL divergence is guaranteed to be strictly non-negative. Cross-entropy on continuous distributions (as opposed to discrete distributions) can actually become negative.

In any case, maxdiv_score_intervals should give identical scores to the ones returned from maxdiv/maxdiv_exec when using the same distribution. Could you try to re-score the detected intervals with the same method used by the detector (both for the ID and the full distribution) and confirm that the scores are the same?

Thank you for providing help! Sure, I will try to confirm that the scores are the same, I will keep you updated. Thx!

from libmaxdiv.

Callidior avatar Callidior commented on June 9, 2024

As an addendum: The scores of our "unbiased KL divergence" can also become negative, if the distributions are very similar.
It is true that for the normal KL divergence, 0 is the minimum. In the paper, the unbiased KL divergence is defined as:
\mathrm{KL}_{\mathrm{U}} = 2 \cdot |I| \cdot \mathrm{KL}

However, in the source code we made one additional tweak to make scores more comparable for time-series of different dimensionality d: We subtract the theoretical mean of this statistic, which is distributed according to a chi-square distribution, and divide by the standard deviation. Thus, the unbiased KL divergence computed by libmaxdiv is actually:

image

Due to the subtraction of this constant factor, the unbiased KL divergence can become negative. The order of anomaly scores is preserved, however.

from libmaxdiv.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.