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