cc.mallet.classify
Class MaxEnt

java.lang.Object
  extended by cc.mallet.classify.Classifier
      extended by 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
protected  int defaultFeatureIndex
           
protected  FeatureSelection featureSelection
           
protected  double[] parameters
           
protected  FeatureSelection[] perClassFeatureSelection
           
 
Fields inherited from class cc.mallet.classify.Classifier
instancePipe
 
Constructor Summary
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
 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.out
 void print(java.io.PrintStream 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, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 class Classifier

setFeatureSelection

public MaxEnt setFeatureSelection(FeatureSelection fs)

getPerClassFeatureSelection

public FeatureSelection[] getPerClassFeatureSelection()
Overrides:
getPerClassFeatureSelection in class Classifier

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 class Classifier

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 class Classifier

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)