@Test public void testComputeThreshold(){ double threshold = function.computeThreshold(LABEL_CONFIDENCES[0]); assertEquals("Computed threshold is not as expected.", THRESHOLD_FOR_EXAMPLE_1, threshold, DOUBLES_EQUAL_DIFF); threshold = function.computeThreshold(LABEL_CONFIDENCES[1]); assertEquals("Computed threshold is not as expected.", THRESHOLD_FOR_EXAMPLE_2, threshold, DOUBLES_EQUAL_DIFF); threshold = function.computeThreshold(LABEL_CONFIDENCES[2]); assertEquals("Computed threshold is not as expected.", THRESHOLD_FOR_EXAMPLE_3, threshold, DOUBLES_EQUAL_DIFF); threshold = function.computeThreshold(LABEL_CONFIDENCES[3]); assertEquals("Computed threshold is not as expected.", THRESHOLD_FOR_EXAMPLE_4, threshold, DOUBLES_EQUAL_DIFF); }
public double computeThreshold(final double[] labelsConfidences) { int expectedDim = parameters.length - 1; if (labelsConfidences.length != expectedDim) { throw new IllegalArgumentException("The array of label confidences has wrong dimension." + "The function expect parameters of length : " + expectedDim); } double threshold = 0; for (int index = 0; index < expectedDim; index++) { threshold += labelsConfidences[index] * parameters[index]; } threshold += parameters[expectedDim]; return threshold; }
ThresholdFunction implements Serializable { public double computeThreshold(final double[] labelsConfidences) { int expectedDim = parameters.length - 1; if (labelsConfidences.length != expectedDim) { throw new IllegalArgumentException("The array of label confidences has wrong dimension." + "The function expect parameters of length : " + expectedDim); } double threshold = 0; for (int index = 0; index < expectedDim; index++) { threshold += labelsConfidences[index] * parameters[index]; } threshold += parameters[expectedDim]; return threshold; } }
ThresholdFunction implements Serializable { public double computeThreshold(final double[] labelsConfidences) { int expectedDim = parameters.length - 1; if (labelsConfidences.length != expectedDim) { throw new IllegalArgumentException("The array of label confidences has wrong dimension." + "The function expect parameters of length : " + expectedDim); } double threshold = 0; for (int index = 0; index < expectedDim; index++) { threshold += labelsConfidences[index] * parameters[index]; } threshold += parameters[expectedDim]; return threshold; } ThresholdFunction(final double[][] idealLabels, final double[][] modelOutLabels); }
ThresholdFunction implements Serializable { public double computeThreshold(final double[] labelsConfidences) { int expectedDim = parameters.length - 1; if (labelsConfidences.length != expectedDim) { throw new IllegalArgumentException("The array of label confidences has wrong dimension." + "The function expect parameters of length : " + expectedDim); } double threshold = 0; for (int index = 0; index < expectedDim; index++) { threshold += labelsConfidences[index] * parameters[index]; } threshold += parameters[expectedDim]; return threshold; } ThresholdFunction(final double[][] idealLabels, final double[][] modelOutLabels); double computeThreshold(final double[] labelsConfidences); void build(final double[][] idealLabels, final double[][] modelOutLabels); }
ThresholdFunction implements Serializable { public double computeThreshold(final double[] labelsConfidences) { int expectedDim = parameters.length - 1; if (labelsConfidences.length != expectedDim) { throw new IllegalArgumentException("The array of label confidences has wrong dimension." + "The function expect parameters of length : " + expectedDim); } double threshold = 0; for (int index = 0; index < expectedDim; index++) { threshold += labelsConfidences[index] * parameters[index]; } threshold += parameters[expectedDim]; return threshold; } ThresholdFunction(final double[][] idealLabels, final double[][] modelOutLabels); double computeThreshold(final double[] labelsConfidences); void build(final double[][] idealLabels, final double[][] modelOutLabels);  }