Package cc.mallet.classify
Class MaxEntOptimizableByLabelLikelihood
- java.lang.Object
-
- cc.mallet.classify.MaxEntOptimizableByLabelLikelihood
-
- All Implemented Interfaces:
Optimizable
,Optimizable.ByGradientValue
public class MaxEntOptimizableByLabelLikelihood extends java.lang.Object implements Optimizable.ByGradientValue
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface cc.mallet.optimize.Optimizable
Optimizable.ByBatchGradient, Optimizable.ByCombiningBatchGradient, Optimizable.ByGISUpdate, Optimizable.ByGradient, Optimizable.ByGradientValue, Optimizable.ByHessian, Optimizable.ByValue, Optimizable.ByVotedPerceptron
-
-
Constructor Summary
Constructors Constructor Description MaxEntOptimizableByLabelLikelihood()
MaxEntOptimizableByLabelLikelihood(InstanceList trainingSet, MaxEnt initialClassifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MaxEnt
getClassifier()
int
getNumParameters()
double
getParameter(int index)
void
getParameters(double[] buff)
double
getValue()
int
getValueCalls()
Counts how many times this trainer has computed the log probability of training labels.void
getValueGradient(double[] buffer)
int
getValueGradientCalls()
Counts how many times this trainer has computed the gradient of the log probability of training labels.MaxEntOptimizableByLabelLikelihood
setGaussianPriorVariance(double gaussianPriorVariance)
Sets a parameter to prevent overtraining.MaxEntOptimizableByLabelLikelihood
setHyperbolicPriorSharpness(double hyperbolicPriorSharpness)
MaxEntOptimizableByLabelLikelihood
setHyperbolicPriorSlope(double hyperbolicPriorSlope)
void
setParameter(int index, double v)
void
setParameters(double[] buff)
MaxEntOptimizableByLabelLikelihood
useGaussianPrior()
MaxEntOptimizableByLabelLikelihood
useHyperbolicPrior()
MaxEntOptimizableByLabelLikelihood
useNoPrior()
In some cases a prior term is implemented in the optimizer, (eg orthant-wise L-BFGS), so we occasionally want to only calculate the log likelihood.
-
-
-
Constructor Detail
-
MaxEntOptimizableByLabelLikelihood
public MaxEntOptimizableByLabelLikelihood()
-
MaxEntOptimizableByLabelLikelihood
public MaxEntOptimizableByLabelLikelihood(InstanceList trainingSet, MaxEnt initialClassifier)
-
-
Method Detail
-
getClassifier
public MaxEnt getClassifier()
-
getParameter
public double getParameter(int index)
- Specified by:
getParameter
in interfaceOptimizable
-
setParameter
public void setParameter(int index, double v)
- Specified by:
setParameter
in interfaceOptimizable
-
getNumParameters
public int getNumParameters()
- Specified by:
getNumParameters
in interfaceOptimizable
-
getParameters
public void getParameters(double[] buff)
- Specified by:
getParameters
in interfaceOptimizable
-
setParameters
public void setParameters(double[] buff)
- Specified by:
setParameters
in interfaceOptimizable
-
getValue
public double getValue()
- Specified by:
getValue
in interfaceOptimizable.ByGradientValue
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradient
in interfaceOptimizable.ByGradientValue
-
getValueGradientCalls
public int getValueGradientCalls()
Counts how many times this trainer has computed the gradient of the log probability of training labels.
-
getValueCalls
public int getValueCalls()
Counts how many times this trainer has computed the log probability of training labels.
-
useGaussianPrior
public MaxEntOptimizableByLabelLikelihood useGaussianPrior()
-
useHyperbolicPrior
public MaxEntOptimizableByLabelLikelihood useHyperbolicPrior()
-
useNoPrior
public MaxEntOptimizableByLabelLikelihood useNoPrior()
In some cases a prior term is implemented in the optimizer, (eg orthant-wise L-BFGS), so we occasionally want to only calculate the log likelihood.
-
setGaussianPriorVariance
public MaxEntOptimizableByLabelLikelihood setGaussianPriorVariance(double gaussianPriorVariance)
Sets a parameter to prevent overtraining. A smaller variance for the prior means that feature weights are expected to hover closer to 0, so extra evidence is required to set a higher weight.- Returns:
- This trainer
-
setHyperbolicPriorSlope
public MaxEntOptimizableByLabelLikelihood setHyperbolicPriorSlope(double hyperbolicPriorSlope)
-
setHyperbolicPriorSharpness
public MaxEntOptimizableByLabelLikelihood setHyperbolicPriorSharpness(double hyperbolicPriorSharpness)
-
-