public class QualityStats extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QualityStats.RecallPoint
A certain rank in which a relevant doc was found.
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_POINTS
Number of points for which precision is computed.
|
Constructor and Description |
---|
QualityStats(double maxGoodPoints,
long searchTime)
Construct a QualityStats object with anticipated maximal number of relevant hits.
|
Modifier and Type | Method and Description |
---|---|
void |
addResult(int n,
boolean isRelevant,
long docNameExtractTime)
Add a (possibly relevant) doc.
|
static QualityStats |
average(QualityStats[] stats)
Create a QualityStats object that is the average of the input QualityStats objects.
|
double |
getAvp()
Return the average precision at recall points.
|
long |
getDocNamesExtractTime()
Returns the time it took to extract doc names for judging the measured query, in milliseconds.
|
double |
getMaxGoodPoints()
Returns the maximal number of good points.
|
double |
getMRR()
Returns the Mean reciprocal rank over the queries or RR for a single query.
|
double |
getNumGoodPoints()
Returns the number of good points (only relevant points).
|
double |
getNumPoints()
Returns the number of points (both relevant and irrelevant points).
|
double |
getPrecisionAt(int n)
Return the precision at rank n:
|{relevant hits within first
n hits}| / n . |
double |
getRecall()
Return the recall: |{relevant hits found}| / |{relevant hits existing}|.
|
QualityStats.RecallPoint[] |
getRecallPoints()
Returns the recallPoints.
|
long |
getSearchTime()
Returns the search time in milliseconds for the measured query.
|
void |
log(String title,
int paddLines,
PrintWriter logger,
String prefix)
Log information on this QualityStats object.
|
public static final int MAX_POINTS
public QualityStats(double maxGoodPoints, long searchTime)
maxGoodPoints
- maximal possible relevant hits.public void addResult(int n, boolean isRelevant, long docNameExtractTime)
n
- rank of the added doc (its ordinal position within the query results).isRelevant
- true if the added doc is relevant, false otherwise.public double getPrecisionAt(int n)
n
hits}| / n
.n
- requested precision point, must be at least 1 and at most MAX_POINTS
.public double getAvp()
public double getRecall()
public void log(String title, int paddLines, PrintWriter logger, String prefix)
logger
- Logger.prefix
- prefix before each log line.public static QualityStats average(QualityStats[] stats)
stats
- array of input stats to be averaged.public long getDocNamesExtractTime()
public double getMaxGoodPoints()
public double getNumGoodPoints()
public double getNumPoints()
public QualityStats.RecallPoint[] getRecallPoints()
public double getMRR()
Reciprocal rank is defined as 1/r
where r
is the
rank of the first correct result, or 0
if there are no correct
results within the top 5 results.
This follows the definition in Question Answering - CNLP at the TREC-10 Question Answering Track.
public long getSearchTime()