Package cc.mallet.classify
Class MCMaxEntTrainer
- java.lang.Object
-
- cc.mallet.classify.ClassifierTrainer<MCMaxEnt>
-
- cc.mallet.classify.MCMaxEntTrainer
-
- All Implemented Interfaces:
Boostable
,java.io.Serializable
public class MCMaxEntTrainer extends ClassifierTrainer<MCMaxEnt> implements Boostable, java.io.Serializable
The trainer for a Maximum Entropy classifier.- Author:
- Andrew McCallum mccallum@cs.umass.edu
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class cc.mallet.classify.ClassifierTrainer
ClassifierTrainer.ByActiveLearning<C extends Classifier>, ClassifierTrainer.ByIncrements<C extends Classifier>, ClassifierTrainer.ByInstanceIncrements<C extends Classifier>, ClassifierTrainer.ByOptimization<C extends Classifier>, ClassifierTrainer.Factory<CT extends ClassifierTrainer<? extends Classifier>>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXP_GAIN
static java.lang.String
GRADIENT_GAIN
static java.lang.String
INFORMATION_GAIN
-
Fields inherited from class cc.mallet.classify.ClassifierTrainer
finishedTraining, validationSet
-
-
Constructor Summary
Constructors Constructor Description MCMaxEntTrainer()
MCMaxEntTrainer(boolean useHyperbolicPrior)
MCMaxEntTrainer(double gaussianPriorVariance)
Constructs a trainer with a parameter to avoid overtraining.MCMaxEntTrainer(double gaussianPriorVariance, boolean useMultiConditionalTraining)
MCMaxEntTrainer(double hyperbolicPriorSlope, double hyperbolicPriorSharpness)
MCMaxEntTrainer(MCMaxEnt initialClassifier)
MCMaxEntTrainer(CommandOption.List col)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MCMaxEnt
getClassifier()
static CommandOption.List
getCommandOptionList()
Optimizable.ByGradientValue
getMaximizableTrainer(InstanceList ilist)
int
getValueCalls()
Counts how many times this trainer has computed the log probability of training labels.int
getValueGradientCalls()
Counts how many times this trainer has computed the gradient of the log probability of training labels.MCMaxEntTrainer
setGaussianPriorVariance(double gaussianPriorVariance)
Sets a parameter to prevent overtraining.MCMaxEntTrainer
setHyperbolicPriorSharpness(double hyperbolicPriorSharpness)
MCMaxEntTrainer
setHyperbolicPriorSlope(double hyperbolicPriorSlope)
MCMaxEntTrainer
setNumIterations(int i)
Specifies the maximum number of iterations to run during a single call totrain
ortrainWithFeatureInduction
.MCMaxEntTrainer
setUseHyperbolicPrior(boolean useHyperbolicPrior)
java.lang.String
toString()
MCMaxEnt
train(InstanceList trainingSet)
-
Methods inherited from class cc.mallet.classify.ClassifierTrainer
getValidationInstances, isFinishedTraining, setValidationInstances
-
-
-
-
Field Detail
-
EXP_GAIN
public static final java.lang.String EXP_GAIN
- See Also:
- Constant Field Values
-
GRADIENT_GAIN
public static final java.lang.String GRADIENT_GAIN
- See Also:
- Constant Field Values
-
INFORMATION_GAIN
public static final java.lang.String INFORMATION_GAIN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MCMaxEntTrainer
public MCMaxEntTrainer(CommandOption.List col)
-
MCMaxEntTrainer
public MCMaxEntTrainer(MCMaxEnt initialClassifier)
-
MCMaxEntTrainer
public MCMaxEntTrainer()
-
MCMaxEntTrainer
public MCMaxEntTrainer(boolean useHyperbolicPrior)
-
MCMaxEntTrainer
public MCMaxEntTrainer(double gaussianPriorVariance)
Constructs a trainer with a parameter to avoid overtraining. 1.0 is usually a reasonable default value.
-
MCMaxEntTrainer
public MCMaxEntTrainer(double gaussianPriorVariance, boolean useMultiConditionalTraining)
-
MCMaxEntTrainer
public MCMaxEntTrainer(double hyperbolicPriorSlope, double hyperbolicPriorSharpness)
-
-
Method Detail
-
getCommandOptionList
public static CommandOption.List getCommandOptionList()
-
getMaximizableTrainer
public Optimizable.ByGradientValue getMaximizableTrainer(InstanceList ilist)
-
setNumIterations
public MCMaxEntTrainer setNumIterations(int i)
Specifies the maximum number of iterations to run during a single call totrain
ortrainWithFeatureInduction
. Not currently functional.- Returns:
- This trainer
-
setUseHyperbolicPrior
public MCMaxEntTrainer setUseHyperbolicPrior(boolean useHyperbolicPrior)
-
setGaussianPriorVariance
public MCMaxEntTrainer 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 MCMaxEntTrainer setHyperbolicPriorSlope(double hyperbolicPriorSlope)
-
setHyperbolicPriorSharpness
public MCMaxEntTrainer setHyperbolicPriorSharpness(double hyperbolicPriorSharpness)
-
getClassifier
public MCMaxEnt getClassifier()
- Specified by:
getClassifier
in classClassifierTrainer<MCMaxEnt>
-
train
public MCMaxEnt train(InstanceList trainingSet)
- Specified by:
train
in classClassifierTrainer<MCMaxEnt>
-
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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-