public abstract class Classifier extends Object
All classification techniques in MALLET are implemented as two classes: a trainer and a classifier. The trainer injests the training data and creates a classifier that holds the parameters set during training. The classifier applies those parameters to an Instance to produce a classification of the Instance.
A concrete classifier is required only to be able to classify an instance.
Methods for classifying an InstanceList are here. There are
also methods for calculating precison, recall, and f1 from either
InstanceLists (which are classified first) or an ArrayList of
classifications. Similar functionality is also in
Trial
A classifier holds a reference to the pipe that was used to create the Instances being classified. Most classifiers use this to make sure the Alphabets of the instances being classified are the same Alphabet objects used during training.
Alphabets are allowed to between training and classification.
ClassifierTrainer,
Instance,
InstanceList,
Classification,
Trial| Modifier and Type | Field and Description |
|---|---|
protected Pipe |
instancePipe |
| Modifier | Constructor and Description |
|---|---|
protected |
Classifier()
For serialization only.
|
|
Classifier(Pipe instancePipe) |
| Modifier and Type | Method and Description |
|---|---|
abstract Classification |
classify(Instance instance) |
Classification[] |
classify(Instance[] instances) |
ArrayList |
classify(InstanceList instances) |
Classification |
classify(Object obj) |
double |
getAccuracy(ArrayList classifications) |
double |
getAccuracy(InstanceList ilist) |
Alphabet |
getAlphabet() |
double |
getF1(ArrayList classification,
int index)
Calculate the F1-measure for a particular target index from an
array list of classifications
|
double |
getF1(ArrayList classification,
Object entry)
Calculate the F1-measure for a particular target entry from an
array list of classifications
|
double |
getF1(InstanceList ilist,
int index)
Calculate the F1-measure of the classifier on an instance list for a
particular target index
|
double |
getF1(InstanceList ilist,
Object entry)
Calculate the F1-measure of the classifier on an instance list for a
particular target entry
|
Pipe |
getInstancePipe() |
LabelAlphabet |
getLabelAlphabet() |
double |
getPrecision(ArrayList classification,
int index)
Calculate the precision for a particular target index from an
array list of classifications
|
double |
getPrecision(ArrayList classification,
Object entry)
Calculate the precision for a particular target entry from an
array list of classifications
|
double |
getPrecision(InstanceList ilist,
int index)
Calculate the precision of the classifier on an instances list for a
particular target index
|
double |
getPrecision(InstanceList ilist,
Object entry)
Calculate the precision of the classifier on an instance list for a
particular target entry
|
double |
getRecall(ArrayList classification,
int index)
Calculate the recall for a particular target index from an
array list of classifications
|
double |
getRecall(ArrayList classification,
Object entry)
Calculate the recall for a particular target entry from an
array list of classifications
|
double |
getRecall(InstanceList ilist,
int index)
Calculate the recall of the classifier on an instance list for a
particular target index
|
double |
getRecall(InstanceList ilist,
Object entry)
Calculate the recall of the classifier on an instance list for a
particular target entry
|
void |
print()
Outputs human-readable description of classifier (e.g., list of weights, decision tree)
to System.out
|
void |
print(PrintWriter out) |
protected Pipe instancePipe
protected Classifier()
public Classifier(Pipe instancePipe)
public Pipe getInstancePipe()
public Alphabet getAlphabet()
public LabelAlphabet getLabelAlphabet()
public ArrayList classify(InstanceList instances)
public Classification[] classify(Instance[] instances)
public abstract Classification classify(Instance instance)
public Classification classify(Object obj)
public double getAccuracy(InstanceList ilist)
public double getAccuracy(ArrayList classifications)
public double getPrecision(InstanceList ilist, Object entry)
public double getPrecision(ArrayList classification, Object entry)
public double getPrecision(InstanceList ilist, int index)
public double getPrecision(ArrayList classification, int index)
public double getRecall(InstanceList ilist, Object entry)
public double getRecall(InstanceList ilist, int index)
public double getRecall(ArrayList classification, Object entry)
public double getRecall(ArrayList classification, int index)
public double getF1(InstanceList ilist, Object entry)
public double getF1(InstanceList ilist, int index)
public double getF1(ArrayList classification, Object entry)
public double getF1(ArrayList classification, int index)
public void print()
public void print(PrintWriter out)
Copyright © 2019 JULIE Lab, Germany. All rights reserved.