|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.stats.PrecisionRecallStats
Utility class for aggregating counts of true positives, false positives, and false negatives and computing precision/recall/F1 stats. Can be used for a single collection of stats, or to aggregate stats from a bunch of runs.
Field Summary | |
protected int |
fnCount
Count of false negatives. |
protected int |
fpCount
Count of false positives. |
protected int |
tpCount
Count of true positives. |
Constructor Summary | |
PrecisionRecallStats()
Constructs a new PrecisionRecallStats with initially 0 counts. |
|
PrecisionRecallStats(int tp,
int fp,
int fn)
Constructs a new PrecisionRecallStats with the given initial counts. |
Method Summary | |
void |
addCounts(PrecisionRecallStats prs)
Adds the counts from the given stats to the counts of this stats. |
void |
addFN(int count)
Adds the given number to the count of false negatives. |
void |
addFP(int count)
Adds the given number to the count of false positives. |
void |
addTP(int count)
Adds the given number to the count of true positives. |
double |
getFMeasure()
Returns the current F1 measure (alpha=0.5). |
double |
getFMeasure(double alpha)
Returns the F-Measure with the given mixing parameter (must be between 0 and 1). |
int |
getFN()
Returns the current count of false negatives. |
int |
getFP()
Returns the current count of false positives. |
double |
getPrecision()
Returns the current precision: tp/(tp+fp). |
double |
getRecall()
Returns the current recall: tp/(tp+fn). |
int |
getTP()
Returns the current count of true positives. |
void |
incrementFN()
Adds one to the count of false negatives. |
void |
incrementFP()
Adds one to the count of false positives. |
void |
incrementTP()
Adds one to the count of true positives. |
String |
toString()
Returns a String representation of this PrecisionRecallStats, indicating the number of tp, fp, fn counts. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int tpCount
protected int fpCount
protected int fnCount
Constructor Detail |
public PrecisionRecallStats()
public PrecisionRecallStats(int tp, int fp, int fn)
Method Detail |
public int getTP()
public int getFP()
public int getFN()
public void addTP(int count)
public void incrementTP()
public void addFP(int count)
public void incrementFP()
public void addFN(int count)
public void incrementFN()
public void addCounts(PrecisionRecallStats prs)
public double getPrecision()
public double getRecall()
public double getFMeasure()
public double getFMeasure(double alpha)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |