NegLogLikelihood (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.ml.maxent.quasinewton

## Class NegLogLikelihood

- java.lang.Object
- - opennlp.tools.ml.maxent.quasinewton.NegLogLikelihood

- All Implemented Interfaces:
    Function
  Direct Known Subclasses:
    ParallelNegLogLikelihood

      public class NegLogLikelihood
      extends Object
      implements Function

  Evaluate negative log-likelihood and its gradient from DataIndexer.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NegLogLikelihood(DataIndexer indexer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDimension()`
    `double[]` | `getInitialPoint()`
    `double[]` | `gradientAt(double[] x)` Compute gradient
    `double` | `valueAt(double[] x)` Negative log-likelihood

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NegLogLikelihood

          public NegLogLikelihood(DataIndexer indexer)

  - ### Method Detail

    - #### getDimension

          public int getDimension()

      Specified by:
        `getDimension` in interface `Function`

    - #### getInitialPoint

          public double[] getInitialPoint()

    - #### valueAt

          public double valueAt(double[] x)

      Negative log-likelihood
      Specified by:
        `valueAt` in interface `Function`

    - #### gradientAt

          public double[] gradientAt(double[] x)

      Compute gradient
      Specified by:
        `gradientAt` in interface `Function`

Copyright © 2026 The Apache Software Foundation. All rights reserved.