Package opennlp.tools.ml.maxent.quasinewton

# Class ParallelNegLogLikelihood

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

All Implemented Interfaces:
  `Function`

public class ParallelNegLogLikelihood extends NegLogLikelihood
Evaluates `negative log-likelihood` and its gradient in parallel.

See Also:
  - `Function`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ParallelNegLogLikelihood(DataIndexer indexer, int threads)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double[]`
  `gradientAt(double[] x)`
  Computes the gradient for `x`.
  `double`
  `valueAt(double[] x)`
  Computes the function value for `x`.

  ### Methods inherited from class opennlp.tools.ml.maxent.quasinewton.NegLogLikelihood

  `getDimension, getInitialPoint`

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

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

- ## Constructor Details

  - ### ParallelNegLogLikelihood

    public ParallelNegLogLikelihood(DataIndexer indexer, int threads)
    Parameters:
      `indexer` - The `DataIndexer` to use as input provider.
      `threads` - The number of thread to compute with in parallel. Must be greater than `0`.
    Throws:
      `IllegalArgumentException` - Thrown if parameters were invalid.

- ## Method Details

  - ### valueAt

    public double valueAt(double[] x)
    Computes the function value for `x`.
    Specified by:
      `valueAt` in interface `Function`
    Overrides:
      `valueAt` in class `NegLogLikelihood`
    Parameters:
      `x` - The input.
    Returns:
      Returns the computed negative log-likelihood.
    Throws:
      `IllegalArgumentException` - Thrown if parameters were invalid.

  - ### gradientAt

    public double[] gradientAt(double[] x)
    Computes the gradient for `x`.
    Specified by:
      `gradientAt` in interface `Function`
    Overrides:
      `gradientAt` in class `NegLogLikelihood`
    Parameters:
      `x` - The input.
    Returns:
      Returns the computed gradient.
    Throws:
      `IllegalArgumentException` - Thrown if parameters were invalid.