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 void
add(int index, Classification c)
boolean
add(Classification c)
boolean
addAll(int index, java.util.Collection<? extends Classification> collection)
boolean
addAll(java.util.Collection<? extends Classification> collection)
double
getAccuracy()
Return the fraction of instances that have the correct label as their best predicted label.double
getAverageRank()
Return the average rank of the correct class label as returned by Labeling.getRank(correctLabel) on the predicted Labeling.Classifier
getClassifier()
double
getF1(int index)
Calculate the F1-measure for a particular target index from an array list of classificationsdouble
getF1(Labeling label)
double
getF1(java.lang.Object labelEntry)
Calculate the F1-measure of the classifier on an instance list for a particular target entrydouble
getPrecision(int index)
Calculate the precision for a particular target index from an array list of classificationsdouble
getPrecision(Labeling label)
double
getPrecision(java.lang.Object labelEntry)
Calculate the precision of the classifier on an instance list for a particular target entrydouble
getRecall(int labelIndex)
Calculate the recall for a particular target index from an array list of classificationsdouble
getRecall(Labeling label)
double
getRecall(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:
add
in interfacejava.util.Collection<Classification>
- Specified by:
add
in interfacejava.util.List<Classification>
- Overrides:
add
in classjava.util.ArrayList<Classification>
-
add
public void add(int index, Classification c)
- Specified by:
add
in interfacejava.util.List<Classification>
- Overrides:
add
in classjava.util.ArrayList<Classification>
-
addAll
public boolean addAll(java.util.Collection<? extends Classification> collection)
- Specified by:
addAll
in interfacejava.util.Collection<Classification>
- Specified by:
addAll
in interfacejava.util.List<Classification>
- Overrides:
addAll
in classjava.util.ArrayList<Classification>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends Classification> collection)
- Specified by:
addAll
in interfacejava.util.List<Classification>
- Overrides:
addAll
in 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.
-
-