Class NegLogLikelihood
java.lang.Object
opennlp.tools.ml.maxent.quasinewton.NegLogLikelihood
- All Implemented Interfaces:
Function
- Direct Known Subclasses:
ParallelNegLogLikelihood
Evaluates negative log-likelihood and its gradient from
DataIndexer.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int[][]protected final intprotected final double[]protected final double[]protected final intprotected final intprotected final intprotected final int[]protected final int[]protected final double[]protected final float[][] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdouble[]double[]gradientAt(double[] x) Computes the gradient.protected intindexOf(int outcomeId, int featureId) doublevalueAt(double[] x) Computes the negative log-likelihood.
-
Field Details
-
dimension
protected final int dimension -
numOutcomes
protected final int numOutcomes -
numFeatures
protected final int numFeatures -
numContexts
protected final int numContexts -
values
protected final float[][] values -
contexts
protected final int[][] contexts -
outcomeList
protected final int[] outcomeList -
numTimesEventsSeen
protected final int[] numTimesEventsSeen -
tempSums
protected final double[] tempSums -
expectation
protected final double[] expectation -
gradient
protected final double[] gradient
-
-
Constructor Details
-
NegLogLikelihood
- Parameters:
indexer- TheDataIndexerto use as input provider.
-
-
Method Details
-
getDimension
public int getDimension()- Specified by:
getDimensionin interfaceFunction- Returns:
- Retrieves the dimension value.
-
getInitialPoint
public double[] getInitialPoint()- Returns:
- Retrieves the initial point as
doublearray.
-
valueAt
public double valueAt(double[] x) Computes the negative log-likelihood.- Specified by:
valueAtin interfaceFunction- 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.- Specified by:
gradientAtin interfaceFunction- Parameters:
x- The input.- Returns:
- Returns the computed gradient.
- Throws:
IllegalArgumentException- Thrown if parameters were invalid.
-
indexOf
protected int indexOf(int outcomeId, int featureId)
-