Class 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
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • 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 classifications
      double getF1​(Labeling label)  
      double getF1​(java.lang.Object labelEntry)
      Calculate the F1-measure of the classifier on an instance list for a particular target entry
      double getPrecision​(int index)
      Calculate the precision for a particular target index from an array list of classifications
      double getPrecision​(Labeling label)  
      double getPrecision​(java.lang.Object labelEntry)
      Calculate the precision of the classifier on an instance list for a particular target entry
      double getRecall​(int labelIndex)
      Calculate the recall for a particular target index from an array list of classifications
      double 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
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Method Detail

      • addAll

        public boolean addAll​(java.util.Collection<? extends Classification> collection)
        Specified by:
        addAll in interface java.util.Collection<Classification>
        Specified by:
        addAll in interface java.util.List<Classification>
        Overrides:
        addAll in class java.util.ArrayList<Classification>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends Classification> collection)
        Specified by:
        addAll in interface java.util.List<Classification>
        Overrides:
        addAll in class java.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.