@Test public void testNormalizeLog2probs() { final Map<Integer, Double> testNumbers = Maps.newTreeMap(); testNumbers.put(1, -100.); testNumbers.put(2, -100.); testNumbers.put(3, -100.); StatsUtil.normalizeLog2Probs(testNumbers); assertEquals(testNumbers.get(1), 1. / 3, 10E-10); assertEquals(testNumbers.get(2), 1. / 3, 10E-10); assertEquals(testNumbers.get(3), 1. / 3, 10E-10); testNumbers.clear(); testNumbers.put(1, -100.); testNumbers.put(2, -1000.); testNumbers.put(3, -5000.); StatsUtil.normalizeLog2Probs(testNumbers); assertEquals(testNumbers.get(1), 1., 10E-10); assertEquals(testNumbers.get(2), 0, 10E-10); assertEquals(testNumbers.get(3), 0, 10E-10); }
public static void normalizeLog2Probs(final double[] log2prob) { final double sum = log2SumOfExponentials(log2prob); for (int i = 0; i < log2prob.length; i++) { log2prob[i] = Math.pow(2, log2prob[i] - sum); } }
StatsUtil { public static void normalizeLog2Probs(final double[] log2prob) { final double sum = log2SumOfExponentials(log2prob); for (int i = 0; i < log2prob.length; i++) { log2prob[i] = Math.pow(2, log2prob[i] - sum); } } }
StatsUtil { public static void normalizeLog2Probs(final double[] log2prob) { final double sum = log2SumOfExponentials(log2prob); for (int i = 0; i < log2prob.length; i++) { log2prob[i] = Math.pow(2, log2prob[i] - sum); } }  }
StatsUtil { public static void normalizeLog2Probs(final double[] log2prob) { final double sum = log2SumOfExponentials(log2prob); for (int i = 0; i < log2prob.length; i++) { log2prob[i] = Math.pow(2, log2prob[i] - sum); } }  static Optional<Integer> argmax(final double[] array); static Optional<T> argmax(final Map<T, Double> valuedObjects); static double[] divideArrayElements(final int[] array,
			final int divisor); static double log2SumOfExponentials(final Collection<Double> values); static double log2SumOfExponentials(final double... values); static double log2SumOfExponentials(final double log2Prob1,
			final double log2Prob2); static double max(final double... array); static Double max(final Iterable<Double> values); static double mean(final Collection<Double> values); static double median(final List<Double> values); static double min(final Collection<Double> xs); static double min(final double... array); static double mode(final Collection<Double> values); static double norm(final double... array); static void normalizeLog2Probs(final double[] log2prob); static void normalizeLog2Probs(final Map<T, Double> log2prob); static double sum(final double... array); static double sum(final Iterable<Double> values); }
StatsUtil { public static void normalizeLog2Probs(final double[] log2prob) { final double sum = log2SumOfExponentials(log2prob); for (int i = 0; i < log2prob.length; i++) { log2prob[i] = Math.pow(2, log2prob[i] - sum); } }  static Optional<Integer> argmax(final double[] array); static Optional<T> argmax(final Map<T, Double> valuedObjects); static double[] divideArrayElements(final int[] array,
			final int divisor); static double log2SumOfExponentials(final Collection<Double> values); static double log2SumOfExponentials(final double... values); static double log2SumOfExponentials(final double log2Prob1,
			final double log2Prob2); static double max(final double... array); static Double max(final Iterable<Double> values); static double mean(final Collection<Double> values); static double median(final List<Double> values); static double min(final Collection<Double> xs); static double min(final double... array); static double mode(final Collection<Double> values); static double norm(final double... array); static void normalizeLog2Probs(final double[] log2prob); static void normalizeLog2Probs(final Map<T, Double> log2prob); static double sum(final double... array); static double sum(final Iterable<Double> values);  }