|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.stats.PrecisionRecallStats
public class 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(Classifier<L,F> classifier,
Dataset<L,F> data,
L positiveClass)
|
|
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. |
java.lang.String |
getF1Description(int numDigits)
Returns a String summarizing F1 that will print nicely. |
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). |
java.lang.String |
getPrecisionDescription(int numDigits)
Returns a String summarizing precision that will print nicely. |
double |
getRecall()
Returns the current recall: tp/(tp+fn). |
java.lang.String |
getRecallDescription(int numDigits)
Returns a String summarizing recall that will print nicely. |
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. |
java.lang.String |
toString()
Returns a String representation of this PrecisionRecallStats, indicating the number of tp, fp, fn counts. |
java.lang.String |
toString(int numDigits)
|
| 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(Classifier<L,F> classifier,
Dataset<L,F> data,
L positiveClass)
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 java.lang.String getPrecisionDescription(int numDigits)
public double getRecall()
public java.lang.String getRecallDescription(int numDigits)
public double getFMeasure()
public double getFMeasure(double alpha)
public java.lang.String getF1Description(int numDigits)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(int numDigits)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||