Correct.

Mathematically speaking, if you have all positive counts then you can't get
a negative score except possibly by round-off error.

On Thu, Apr 29, 2010 at 6:10 AM, Drew Farris <drew.far...@gmail.com> wrote:

> I was under the (perhaps incorrect) impression that negative LLR indicates
> some sort of problem with the input.
>
> On Thu, Apr 29, 2010 at 7:44 AM, Shashikant Kore <shashik...@gmail.com
> >wrote:
>
> > Root LLR calculation has a minor bug. When LLR score is negative,
> > square root is undefined. You can see the result for the following to
> > be NaN.
> >
> > org.apache.mahout.math.stats.LogLikelihood.rootLogLikelihoodRatio(6,
> > 7567, 1924, 2426487)
> >
> > A minor fix would be to return zero if LLR is less than zero as follows.
> >
> > public static double rootLogLikelihoodRatio(int k11, int k12, int k21,
> > int k22) {
> >        double llr = logLikelihoodRatio(k11, k12, k21, k22);
> >        if (llr < 0)
> >             return 0;
> >        return Math.signum(((double) k11 / (k11+k12)) - ((double) k21 /
> > (k21+k22))) * Math.sqrt(llr);
> > }
> >
> > --shashi
> >
>

Reply via email to