Package cc.mallet.classify
Class Trial
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<Classification>
-
- cc.mallet.classify.Trial
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<Classification>,java.util.Collection<Classification>,java.util.List<Classification>,java.util.RandomAccess
public class Trial extends java.util.ArrayList<Classification>
Stores the results of classifying a collection of Instances, and provides many methods for evaluating the results. If you just need one evaluation result, you may find it easier to one of the corresponding methods in Classifier, which simply call the methods here.- Author:
- Andrew McCallum mccallum@cs.umass.edu
- See Also:
InstanceList,Classifier,Classification, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Trial(Classifier c, InstanceList ilist)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Classification c)booleanadd(Classification c)booleanaddAll(int index, java.util.Collection<? extends Classification> collection)booleanaddAll(java.util.Collection<? extends Classification> collection)doublegetAccuracy()Return the fraction of instances that have the correct label as their best predicted label.doublegetAverageRank()Return the average rank of the correct class label as returned by Labeling.getRank(correctLabel) on the predicted Labeling.ClassifiergetClassifier()doublegetF1(int index)Calculate the F1-measure for a particular target index from an array list of classificationsdoublegetF1(Labeling label)doublegetF1(java.lang.Object labelEntry)Calculate the F1-measure of the classifier on an instance list for a particular target entrydoublegetPrecision(int index)Calculate the precision for a particular target index from an array list of classificationsdoublegetPrecision(Labeling label)doublegetPrecision(java.lang.Object labelEntry)Calculate the precision of the classifier on an instance list for a particular target entrydoublegetRecall(int labelIndex)Calculate the recall for a particular target index from an array list of classificationsdoublegetRecall(Labeling label)doublegetRecall(java.lang.Object labelEntry)Calculate the recall of the classifier on an instance list for a particular target entry-
Methods inherited from class java.util.ArrayList
clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Constructor Detail
-
Trial
public Trial(Classifier c, InstanceList ilist)
-
-
Method Detail
-
add
public boolean add(Classification c)
- Specified by:
addin interfacejava.util.Collection<Classification>- Specified by:
addin interfacejava.util.List<Classification>- Overrides:
addin classjava.util.ArrayList<Classification>
-
add
public void add(int index, Classification c)- Specified by:
addin interfacejava.util.List<Classification>- Overrides:
addin classjava.util.ArrayList<Classification>
-
addAll
public boolean addAll(java.util.Collection<? extends Classification> collection)
- Specified by:
addAllin interfacejava.util.Collection<Classification>- Specified by:
addAllin interfacejava.util.List<Classification>- Overrides:
addAllin classjava.util.ArrayList<Classification>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends Classification> collection)- Specified by:
addAllin interfacejava.util.List<Classification>- Overrides:
addAllin classjava.util.ArrayList<Classification>
-
getClassifier
public Classifier getClassifier()
-
getAccuracy
public double getAccuracy()
Return the fraction of instances that have the correct label as their best predicted label.
-
getPrecision
public double getPrecision(java.lang.Object labelEntry)
Calculate the precision of the classifier on an instance list for a particular target entry
-
getPrecision
public double getPrecision(Labeling label)
-
getPrecision
public double getPrecision(int index)
Calculate the precision for a particular target index from an array list of classifications
-
getRecall
public double getRecall(java.lang.Object labelEntry)
Calculate the recall of the classifier on an instance list for a particular target entry
-
getRecall
public double getRecall(Labeling label)
-
getRecall
public double getRecall(int labelIndex)
Calculate the recall for a particular target index from an array list of classifications
-
getF1
public double getF1(java.lang.Object labelEntry)
Calculate the F1-measure of the classifier on an instance list for a particular target entry
-
getF1
public double getF1(Labeling label)
-
getF1
public double getF1(int index)
Calculate the F1-measure for a particular target index from an array list of classifications
-
getAverageRank
public double getAverageRank()
Return the average rank of the correct class label as returned by Labeling.getRank(correctLabel) on the predicted Labeling.
-
-