Package cc.mallet.classify
Class MaxEnt
- java.lang.Object
-
- cc.mallet.classify.Classifier
-
- cc.mallet.classify.MaxEnt
-
- All Implemented Interfaces:
AlphabetCarrying
,java.io.Serializable
- Direct Known Subclasses:
RankMaxEnt
public class MaxEnt extends Classifier implements java.io.Serializable
Maximum Entropy (AKA Multivariate Logistic Regression) classifier.- Author:
- Andrew McCallum mccallum@cs.umass.edu
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
defaultFeatureIndex
protected FeatureSelection
featureSelection
protected double[]
parameters
protected FeatureSelection[]
perClassFeatureSelection
-
Fields inherited from class cc.mallet.classify.Classifier
instancePipe
-
-
Constructor Summary
Constructors Constructor Description MaxEnt(Pipe dataPipe, double[] parameters)
MaxEnt(Pipe dataPipe, double[] parameters, FeatureSelection featureSelection)
MaxEnt(Pipe dataPipe, double[] parameters, FeatureSelection[] perClassFeatureSelection)
MaxEnt(Pipe dataPipe, double[] parameters, FeatureSelection featureSelection, FeatureSelection[] perClassFeatureSelection)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Classification
classify(Instance instance)
void
getClassificationScores(Instance instance, double[] scores)
void
getClassificationScoresWithTemperature(Instance instance, double temperature, double[] scores)
int
getDefaultFeatureIndex()
FeatureSelection
getFeatureSelection()
int
getNumParameters()
static int
getNumParameters(Pipe instancePipe)
double[]
getParameters()
FeatureSelection[]
getPerClassFeatureSelection()
void
getUnnormalizedClassificationScores(Instance instance, double[] scores)
void
print()
Outputs human-readable description of classifier (e.g., list of weights, decision tree) to System.outvoid
print(java.io.PrintStream out)
void
print(java.io.PrintWriter out)
void
printExtremeFeatures(java.io.PrintWriter out, int num)
void
printRank(java.io.PrintWriter out)
void
setDefaultFeatureIndex(int defaultFeatureIndex)
MaxEnt
setFeatureSelection(FeatureSelection fs)
void
setParameter(int classIndex, int featureIndex, double value)
void
setParameters(double[] parameters)
MaxEnt
setPerClassFeatureSelection(FeatureSelection[] fss)
-
Methods inherited from class cc.mallet.classify.Classifier
alphabetsMatch, classify, classify, classify, getAccuracy, getAlphabet, getAlphabets, getAverageRank, getF1, getF1, getF1, getInstancePipe, getLabelAlphabet, getPrecision, getPrecision, getPrecision, getRecall, getRecall, getRecall
-
-
-
-
Field Detail
-
parameters
protected double[] parameters
-
defaultFeatureIndex
protected int defaultFeatureIndex
-
featureSelection
protected FeatureSelection featureSelection
-
perClassFeatureSelection
protected FeatureSelection[] perClassFeatureSelection
-
-
Constructor Detail
-
MaxEnt
public MaxEnt(Pipe dataPipe, double[] parameters, FeatureSelection featureSelection, FeatureSelection[] perClassFeatureSelection)
-
MaxEnt
public MaxEnt(Pipe dataPipe, double[] parameters, FeatureSelection featureSelection)
-
MaxEnt
public MaxEnt(Pipe dataPipe, double[] parameters, FeatureSelection[] perClassFeatureSelection)
-
MaxEnt
public MaxEnt(Pipe dataPipe, double[] parameters)
-
-
Method Detail
-
getParameters
public double[] getParameters()
-
getNumParameters
public int getNumParameters()
-
getNumParameters
public static int getNumParameters(Pipe instancePipe)
-
setParameters
public void setParameters(double[] parameters)
-
setParameter
public void setParameter(int classIndex, int featureIndex, double value)
-
getFeatureSelection
public FeatureSelection getFeatureSelection()
- Overrides:
getFeatureSelection
in classClassifier
-
setFeatureSelection
public MaxEnt setFeatureSelection(FeatureSelection fs)
-
getPerClassFeatureSelection
public FeatureSelection[] getPerClassFeatureSelection()
- Overrides:
getPerClassFeatureSelection
in classClassifier
-
setPerClassFeatureSelection
public MaxEnt setPerClassFeatureSelection(FeatureSelection[] fss)
-
getDefaultFeatureIndex
public int getDefaultFeatureIndex()
-
setDefaultFeatureIndex
public void setDefaultFeatureIndex(int defaultFeatureIndex)
-
getUnnormalizedClassificationScores
public void getUnnormalizedClassificationScores(Instance instance, double[] scores)
-
getClassificationScores
public void getClassificationScores(Instance instance, double[] scores)
-
getClassificationScoresWithTemperature
public void getClassificationScoresWithTemperature(Instance instance, double temperature, double[] scores)
-
classify
public Classification classify(Instance instance)
- Specified by:
classify
in classClassifier
-
print
public void print()
Description copied from class:Classifier
Outputs human-readable description of classifier (e.g., list of weights, decision tree) to System.out- Overrides:
print
in classClassifier
-
print
public void print(java.io.PrintWriter out)
- Overrides:
print
in classClassifier
-
print
public void print(java.io.PrintStream out)
-
printRank
public void printRank(java.io.PrintWriter out)
-
printExtremeFeatures
public void printExtremeFeatures(java.io.PrintWriter out, int num)
-
-