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

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

public class MultiClassPrecisionRecallExtendedStats<L>
extends MultiClassPrecisionRecallStats<L>

Extension of MultiClassPrecisionRecallStats that handles

Author:
Angel Chang

Nested Class Summary
static class MultiClassPrecisionRecallExtendedStats.MultiClassStringLabelStats
           
static class MultiClassPrecisionRecallExtendedStats.StringStringConverter
           
 
Field Summary
protected  IntCounter<L> correctGuesses
           
protected  IntCounter<L> foundCorrect
           
protected  IntCounter<L> foundGuessed
           
protected  Function<String,L> stringConverter
           
protected  int tokensCorrect
           
protected  int tokensCount
           
 
Fields inherited from class edu.stanford.nlp.stats.MultiClassPrecisionRecallStats
fnCount, fpCount, labelIndex, negIndex, negLabel, tpCount
 
Constructor Summary
MultiClassPrecisionRecallExtendedStats(Classifier<L,F> classifier, GeneralDataset<L,F> data, L negLabel)
           
MultiClassPrecisionRecallExtendedStats(Index<L> dataLabelIndex, L negLabel)
           
MultiClassPrecisionRecallExtendedStats(L negLabel)
           
 
Method Summary
protected  void addGuess(L guess, L label)
           
protected  void addGuess(L guess, L label, boolean addUnknownLabels)
           
 void addGuesses(List<L> guesses, List<L> trueLabels)
           
 void clearCounts()
           
protected  void finalizeCounts()
           
 double getAccuracy()
           
 String getAccuracyDescription(int numDigits)
          Returns a String summarizing overall accuracy that will print nicely.
 Triple<Double,Integer,Integer> getAccuracyInfo()
          Return overall per token accuracy
 String getConllEvalString()
           
 String getConllEvalString(boolean ignoreNegLabel)
           
 int getCorrect()
          Return overall number of correct answers
 int getCorrect(L label)
           
 List<L> getLabels()
           
 int getRelevant()
           
 int getRelevant(L label)
           
 int getRetrieved()
           
 int getRetrieved(L label)
           
protected  void markBoundary()
           
 double score()
           
 double score(BufferedReader br, String delimiter)
           
 double score(BufferedReader br, String delimiter, String boundary)
           
<F> double
score(Classifier<L,F> classifier, GeneralDataset<L,F> data)
           
 double score(List<L> guesses, List<L> trueLabels)
          Returns the score (F1) for the given list of guesses
 double score(List<L> guesses, List<L> trueLabels, Index<L> dataLabelIndex)
          Returns the score (F1) for the given list of guesses
 double score(String filename, String delimiter)
           
 double score(String filename, String delimiter, String boundary)
           
 void setLabelIndex(Index<L> dataLabelIndex)
           
 
Methods inherited from class edu.stanford.nlp.stats.MultiClassPrecisionRecallStats
getDescription, getF1Description, getF1Description, getFMeasure, getFMeasure, getPrecision, getPrecision, getPrecisionDescription, getPrecisionDescription, getPrecisionInfo, getPrecisionInfo, getRecall, getRecall, getRecallDescription, getRecallDescription, getRecallInfo, getRecallInfo, score
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

correctGuesses

protected IntCounter<L> correctGuesses

foundCorrect

protected IntCounter<L> foundCorrect

foundGuessed

protected IntCounter<L> foundGuessed

tokensCount

protected int tokensCount

tokensCorrect

protected int tokensCorrect

stringConverter

protected Function<String,L> stringConverter
Constructor Detail

MultiClassPrecisionRecallExtendedStats

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

MultiClassPrecisionRecallExtendedStats

public MultiClassPrecisionRecallExtendedStats(L negLabel)

MultiClassPrecisionRecallExtendedStats

public MultiClassPrecisionRecallExtendedStats(Index<L> dataLabelIndex,
                                              L negLabel)
Method Detail

setLabelIndex

public void setLabelIndex(Index<L> dataLabelIndex)

score

public <F> double score(Classifier<L,F> classifier,
                        GeneralDataset<L,F> data)
Overrides:
score in class MultiClassPrecisionRecallStats<L>

score

public double score(List<L> guesses,
                    List<L> trueLabels,
                    Index<L> dataLabelIndex)
Returns the score (F1) for the given list of guesses

Parameters:
guesses - - Guesses by classifier
trueLabels - - Gold labels to compare guesses against
dataLabelIndex - - Index of labels
Returns:
F1 score

score

public double score(List<L> guesses,
                    List<L> trueLabels)
Returns the score (F1) for the given list of guesses

Parameters:
guesses - - Guesses by classifier
trueLabels - - Gold labels to compare guesses against
Returns:
F1 score

score

public double score()

clearCounts

public void clearCounts()

finalizeCounts

protected void finalizeCounts()

markBoundary

protected void markBoundary()

addGuess

protected void addGuess(L guess,
                        L label)

addGuess

protected void addGuess(L guess,
                        L label,
                        boolean addUnknownLabels)

addGuesses

public void addGuesses(List<L> guesses,
                       List<L> trueLabels)

getCorrect

public int getCorrect()
Return overall number of correct answers


getCorrect

public int getCorrect(L label)

getRetrieved

public int getRetrieved(L label)

getRetrieved

public int getRetrieved()

getRelevant

public int getRelevant(L label)

getRelevant

public int getRelevant()

getAccuracyInfo

public Triple<Double,Integer,Integer> getAccuracyInfo()
Return overall per token accuracy


getAccuracy

public double getAccuracy()

getAccuracyDescription

public String getAccuracyDescription(int numDigits)
Returns a String summarizing overall accuracy that will print nicely.


score

public double score(String filename,
                    String delimiter)
             throws IOException
Throws:
IOException

score

public double score(String filename,
                    String delimiter,
                    String boundary)
             throws IOException
Throws:
IOException

score

public double score(BufferedReader br,
                    String delimiter)
             throws IOException
Throws:
IOException

score

public double score(BufferedReader br,
                    String delimiter,
                    String boundary)
             throws IOException
Throws:
IOException

getLabels

public List<L> getLabels()

getConllEvalString

public String getConllEvalString()

getConllEvalString

public String getConllEvalString(boolean ignoreNegLabel)


Stanford NLP Group