edu.stanford.nlp.stats
Class MultiClassPrecisionRecallStats<L>

java.lang.Object
  extended by edu.stanford.nlp.stats.MultiClassPrecisionRecallStats<L>
All Implemented Interfaces:
Scorer<L>
Direct Known Subclasses:
MultiClassPrecisionRecallExtendedStats

public class MultiClassPrecisionRecallStats<L>
extends Object
implements Scorer<L>

Author:
Jenny Finkel

Field Summary
protected  int[] fnCount
          Count of false negatives.
protected  int[] fpCount
          Count of false positives.
protected  Index<L> labelIndex
           
protected  int negIndex
           
protected  L negLabel
           
protected  int[] tpCount
          Count of true positives.
 
Constructor Summary
MultiClassPrecisionRecallStats(Classifier<L,F> classifier, GeneralDataset<L,F> data, L negLabel)
           
MultiClassPrecisionRecallStats(L negLabel)
           
 
Method Summary
 String getDescription(int numDigits)
          Returns a String summarizing F1 that will print nicely.
 String getF1Description(int numDigits)
          Returns a String summarizing F1 that will print nicely.
 String getF1Description(int numDigits, L label)
           
 double getFMeasure()
           
 double getFMeasure(L label)
           
 double getPrecision()
           
 double getPrecision(L label)
           
 String getPrecisionDescription(int numDigits)
          Returns a String summarizing precision that will print nicely.
 String getPrecisionDescription(int numDigits, L label)
           
 Triple<Double,Integer,Integer> getPrecisionInfo()
           
 Triple<Double,Integer,Integer> getPrecisionInfo(L label)
          Returns the current precision: tp/(tp+fp).
 double getRecall()
           
 double getRecall(L label)
           
 String getRecallDescription(int numDigits)
          Returns a String summarizing precision that will print nicely.
 String getRecallDescription(int numDigits, L label)
           
 Triple<Double,Integer,Integer> getRecallInfo()
           
 Triple<Double,Integer,Integer> getRecallInfo(L label)
           
<F> double
score(Classifier<L,F> classifier, GeneralDataset<L,F> data)
           
<F> double
score(ProbabilisticClassifier<L,F> classifier, GeneralDataset<L,F> data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tpCount

protected int[] tpCount
Count of true positives.


fpCount

protected int[] fpCount
Count of false positives.


fnCount

protected int[] fnCount
Count of false negatives.


labelIndex

protected Index<L> labelIndex

negLabel

protected L negLabel

negIndex

protected int negIndex
Constructor Detail

MultiClassPrecisionRecallStats

public MultiClassPrecisionRecallStats(Classifier<L,F> classifier,
                                      GeneralDataset<L,F> data,
                                      L negLabel)

MultiClassPrecisionRecallStats

public MultiClassPrecisionRecallStats(L negLabel)
Method Detail

score

public <F> double score(ProbabilisticClassifier<L,F> classifier,
                        GeneralDataset<L,F> data)
Specified by:
score in interface Scorer<L>

score

public <F> double score(Classifier<L,F> classifier,
                        GeneralDataset<L,F> data)

getPrecisionInfo

public Triple<Double,Integer,Integer> getPrecisionInfo(L label)
Returns the current precision: tp/(tp+fp). Returns 1.0 if tp and fp are both 0.


getPrecision

public double getPrecision(L label)

getPrecisionInfo

public Triple<Double,Integer,Integer> getPrecisionInfo()

getPrecision

public double getPrecision()

getPrecisionDescription

public String getPrecisionDescription(int numDigits)
Returns a String summarizing precision that will print nicely.


getPrecisionDescription

public String getPrecisionDescription(int numDigits,
                                      L label)

getRecallInfo

public Triple<Double,Integer,Integer> getRecallInfo(L label)

getRecall

public double getRecall(L label)

getRecallInfo

public Triple<Double,Integer,Integer> getRecallInfo()

getRecall

public double getRecall()

getRecallDescription

public String getRecallDescription(int numDigits)
Returns a String summarizing precision that will print nicely.


getRecallDescription

public String getRecallDescription(int numDigits,
                                   L label)

getFMeasure

public double getFMeasure(L label)

getFMeasure

public double getFMeasure()

getF1Description

public String getF1Description(int numDigits)
Returns a String summarizing F1 that will print nicely.


getF1Description

public String getF1Description(int numDigits,
                               L label)

getDescription

public String getDescription(int numDigits)
Returns a String summarizing F1 that will print nicely.

Specified by:
getDescription in interface Scorer<L>


Stanford NLP Group