LogLikelihoodFunction implements DifferentiableFunction { public double valueAt(double[] x) { if (!checkLastX(x)) calculate(x); return value; } LogLikelihoodFunction(DataIndexer indexer); double valueAt(double[] x); double[] gradientAt(double[] x); int getDomainDimension(); double[] getInitialPoint(); String[] getPredLabels(); String[] getOutcomeLabels(); int[][] getOutcomePatterns();  }
@Test public void testValueAtNonInitialPoint01() throws IOException { RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8"); DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1); LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer); double[] nonInitialPoint = new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; double value = objectFunction.valueAt(nonInitialPoint); double expectedValue = -0.000206886; assertEquals(expectedValue, value, TOLERANCE01); }