RegressionModelUtil { static public <K, V extends Number> ValueMap<K, V> computeBinomialProbabilities(RegressionModel.NormalizationMethod normalizationMethod, ValueMap<K, V> values){ if(values.size() != 2){ throw new IllegalArgumentException(); } Iterator<Value<V>> valueIt = values.iterator(); Value<V> firstValue = valueIt.next(); normalizeBinaryLogisticClassificationResult(normalizationMethod, firstValue); Value<V> secondValue = valueIt.next(); secondValue.residual(firstValue); return values; } private  RegressionModelUtil(); static ValueMap<K, V> computeBinomialProbabilities(RegressionModel.NormalizationMethod normalizationMethod, ValueMap<K, V> values); static ValueMap<K, V> computeMultinomialProbabilities(RegressionModel.NormalizationMethod normalizationMethod, ValueMap<K, V> values); static ValueMap<K, V> computeOrdinalProbabilities(RegressionModel.NormalizationMethod normalizationMethod, ValueMap<K, V> values); static Value<V> normalizeRegressionResult(RegressionModel.NormalizationMethod normalizationMethod, Value<V> value); static Value<V> normalizeBinaryLogisticClassificationResult(RegressionModel.NormalizationMethod normalizationMethod, Value<V> value);  }
@Test public void computeBinomialProbabilities(){ ValueMap<String, Float> values = new ValueMap<>(); values.put("yes", new FloatValue(0.3f)); values.put("no", new FloatValue(Float.MAX_VALUE)); RegressionModelUtil.computeBinomialProbabilities(RegressionModel.NormalizationMethod.NONE, values); assertEquals(new FloatValue(0.3f), values.get("yes")); assertEquals(new FloatValue(1f - 0.3f), values.get("no")); }