Package cc.mallet.classify
Class MaxEntOptimizableByGE
- java.lang.Object
-
- cc.mallet.classify.MaxEntOptimizableByGE
-
- All Implemented Interfaces:
Optimizable
,Optimizable.ByGradientValue
public class MaxEntOptimizableByGE extends java.lang.Object implements Optimizable.ByGradientValue
- Author:
- gdruck
-
-
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
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]
cachedGradient
protected double
cachedValue
protected boolean
cacheStale
protected MaxEnt
classifier
protected java.util.ArrayList<MaxEntGEConstraint>
constraints
protected int
defaultFeatureIndex
protected double
gaussianPriorVariance
protected double
objWeight
protected double[]
parameters
protected double
temperature
protected InstanceList
trainingList
-
Constructor Summary
Constructors Constructor Description MaxEntOptimizableByGE(InstanceList trainingList, java.util.ArrayList<MaxEntGEConstraint> constraints, MaxEnt initClassifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MaxEnt
getClassifier()
int
getNumParameters()
double
getParameter(int index)
void
getParameters(double[] buffer)
protected double
getRegularization()
double
getValue()
void
getValueGradient(double[] buffer)
void
setGaussianPriorVariance(double variance)
Sets the variance for Gaussian prior or equivalently the inverse of the weight of the L2 regularization term.void
setParameter(int index, double value)
void
setParameters(double[] params)
void
setTemperature(double temp)
Model probabilities are raised to the power 1/temperature and renormalized.void
setWeight(double weight)
The weight of GE term in the objective function.
-
-
-
Field Detail
-
cacheStale
protected boolean cacheStale
-
defaultFeatureIndex
protected int defaultFeatureIndex
-
temperature
protected double temperature
-
objWeight
protected double objWeight
-
cachedValue
protected double cachedValue
-
gaussianPriorVariance
protected double gaussianPriorVariance
-
cachedGradient
protected double[] cachedGradient
-
parameters
protected double[] parameters
-
trainingList
protected InstanceList trainingList
-
classifier
protected MaxEnt classifier
-
constraints
protected java.util.ArrayList<MaxEntGEConstraint> constraints
-
-
Constructor Detail
-
MaxEntOptimizableByGE
public MaxEntOptimizableByGE(InstanceList trainingList, java.util.ArrayList<MaxEntGEConstraint> constraints, MaxEnt initClassifier)
- Parameters:
trainingList
- List with unlabeled training instances.constraints
- Feature expectation constraints.initClassifier
- Initial classifier.
-
-
Method Detail
-
setGaussianPriorVariance
public void setGaussianPriorVariance(double variance)
Sets the variance for Gaussian prior or equivalently the inverse of the weight of the L2 regularization term.- Parameters:
variance
- Gaussian prior variance.
-
setTemperature
public void setTemperature(double temp)
Model probabilities are raised to the power 1/temperature and renormalized. As the temperature decreases, model probabilities approach 1 for the maximum probability class, and 0 for other classes. DEFAULT: 1- Parameters:
temp
- Temperature.
-
setWeight
public void setWeight(double weight)
The weight of GE term in the objective function.- Parameters:
weight
- GE term weight.
-
getClassifier
public MaxEnt getClassifier()
-
getValue
public double getValue()
- Specified by:
getValue
in interfaceOptimizable.ByGradientValue
-
getRegularization
protected double getRegularization()
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradient
in interfaceOptimizable.ByGradientValue
-
getNumParameters
public int getNumParameters()
- Specified by:
getNumParameters
in interfaceOptimizable
-
getParameter
public double getParameter(int index)
- Specified by:
getParameter
in interfaceOptimizable
-
getParameters
public void getParameters(double[] buffer)
- Specified by:
getParameters
in interfaceOptimizable
-
setParameter
public void setParameter(int index, double value)
- Specified by:
setParameter
in interfaceOptimizable
-
setParameters
public void setParameters(double[] params)
- Specified by:
setParameters
in interfaceOptimizable
-
-