/** * Returns the log-odds for a given probability. * * @param prob the probability * @return the log-odds after the probability has been mapped to * [Utils.SMALL, 1-Utils.SMALL] */ public static /*@pure@*/ double probToLogOdds(double prob) { if (gr(prob, 1) || (sm(prob, 0))) { throw new IllegalArgumentException("probToLogOdds: probability must " + "be in [0,1] " + prob); } double p = SMALL + (1.0 - 2 * SMALL) * prob; return Math.log(p / (1 - p)); }
/** * Returns the log-odds for a given probability. * * @param prob the probability * @return the log-odds after the probability has been mapped to * [Utils.SMALL, 1-Utils.SMALL] */ public static /*@pure@*/ double probToLogOdds(double prob) { if (gr(prob, 1) || (sm(prob, 0))) { throw new IllegalArgumentException("probToLogOdds: probability must " + "be in [0,1] " + prob); } double p = SMALL + (1.0 - 2 * SMALL) * prob; return Math.log(p / (1 - p)); }