|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.share.upenn.MaxEntShell
public class MaxEntShell
Simple wrapper for training a MALLET maxent classifier.
Method Summary | |
---|---|
static Classification[] |
classify(Classifier classifier,
java.util.Iterator<Instance> data)
Compute the maxent classifications for unlabeled instances given by an iterator. |
static Classification |
classify(Classifier classifier,
java.lang.String[] features)
Compute the maxent classification of an instance. |
static Classification[] |
classify(Classifier classifier,
java.lang.String[][] features)
Compute the maxent classifications of an array of instances |
static Classifier |
load(java.io.File modelFile)
Load a classifier from a file. |
static void |
main(java.lang.String[] args)
Command-line wrapper to train, test, or run a maxent classifier. |
static double |
test(Classifier classifier,
java.util.Iterator<Instance> data)
Test a maxent classifier. |
static double |
test(Classifier classifier,
java.lang.String[][] features,
java.lang.String[] labels)
Test a maxent classifier. |
static Classifier |
train(java.util.Iterator<Instance> data,
double var,
java.io.File save)
Train a maxent classifier. |
static Classifier |
train(java.lang.String[][] features,
java.lang.String[] labels,
double var,
java.io.File save)
Train a maxent classifier. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Classifier train(java.lang.String[][] features, java.lang.String[] labels, double var, java.io.File save) throws java.io.IOException
features
represents the features of a training instance. The label for
that instance is in the corresponding position of
labels
.
features
- Each row gives the on features of an instancelabels
- Each position gives the label of an instancevar
- Gaussian prior variance for trainingsave
- if non-null, save the trained model to this file
java.io.IOException
- if the trained model cannot be savedpublic static Classifier train(java.util.Iterator<Instance> data, double var, java.io.File save) throws java.io.IOException
data
returns
training instances with a TokenSequence
as data and a
target object. The tokens in the instance data will be converted to
features.
data
- the iterator over training instancesvar
- Gaussian prior variance for training.save
- if non-null, save the trained model to this file
java.io.IOException
- if the trained model cannot be savedpublic static double test(Classifier classifier, java.lang.String[][] features, java.lang.String[] labels)
classifier
- the classifier to testfeatures
- an array of instances represented as arrays of featureslabels
- corresponding labels
public static double test(Classifier classifier, java.util.Iterator<Instance> data)
classifier
- the classifier to testdata
- an iterator over labeled instances
public static Classification classify(Classifier classifier, java.lang.String[] features)
classifier
- the classifierfeatures
- the features that are on for this instance
public static Classification[] classify(Classifier classifier, java.lang.String[][] features)
classifier
- the classifierfeatures
- each row represents the on features for an instance
public static Classification[] classify(Classifier classifier, java.util.Iterator<Instance> data)
classifier
- the classifierdata
- the iterator over unlabeled instances
public static Classifier load(java.io.File modelFile) throws java.io.IOException, java.lang.ClassNotFoundException
modelFile
- the file
java.io.IOException
- if the file cannot be opened or read
java.lang.ClassNotFoundException
- if the file does not deserializepublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- the command line arguments. Options (shell and Java quoting should be added as needed):
--help
booleantrue
for longer documentation. Default is false
.--prefix-code
Java-code--gaussian-variance
positive-number--train
filenane--test
filename--classify
filename--model
filenamejava.lang.Exception
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |