Class QualityStats
java.lang.Object
org.apache.lucene.benchmark.quality.QualityStats
Results of quality benchmark run for a single query or for a set of queries.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A certain rank in which a relevant doc was found. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Number of points for which precision is computed. -
Constructor Summary
ConstructorsConstructorDescriptionQualityStats
(double maxGoodPoints, long searchTime) Construct a QualityStats object with anticipated maximal number of relevant hits. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Returns the time it took to extract doc names for judging the measured query, in milliseconds.double
Returns the maximal number of good points.double
getMRR()
Returns the Mean reciprocal rank over the queries or RR for a single query.double
Returns the number of good points (only relevant points).double
Returns the number of points (both relevant and irrelevant points).double
getPrecisionAt
(int n) Return the precision at rank n: |{relevant hits within firstn
hits}| /n
.double
Return the recall: |{relevant hits found}| / |{relevant hits existing}|.Returns the recallPoints.long
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.
-
Field Details
-
MAX_POINTS
public static final int MAX_POINTSNumber of points for which precision is computed.- See Also:
-
-
Constructor Details
-
QualityStats
public QualityStats(double maxGoodPoints, long searchTime) Construct a QualityStats object with anticipated maximal number of relevant hits.- Parameters:
maxGoodPoints
- maximal possible relevant hits.
-
-
Method Details
-
addResult
public void addResult(int n, boolean isRelevant, long docNameExtractTime) Add a (possibly relevant) doc.- Parameters:
n
- rank of the added doc (its ordinal position within the query results).isRelevant
- true if the added doc is relevant, false otherwise.
-
getPrecisionAt
public double getPrecisionAt(int n) Return the precision at rank n: |{relevant hits within firstn
hits}| /n
.- Parameters:
n
- requested precision point, must be at least 1 and at mostMAX_POINTS
.
-
getAvp
public double getAvp()Return the average precision at recall points. -
getRecall
public double getRecall()Return the recall: |{relevant hits found}| / |{relevant hits existing}|. -
log
Log information on this QualityStats object.- Parameters:
logger
- Logger.prefix
- prefix before each log line.
-
average
Create a QualityStats object that is the average of the input QualityStats objects.- Parameters:
stats
- array of input stats to be averaged.- Returns:
- an average over the input stats.
-
getDocNamesExtractTime
public long getDocNamesExtractTime()Returns the time it took to extract doc names for judging the measured query, in milliseconds. -
getMaxGoodPoints
public double getMaxGoodPoints()Returns the maximal number of good points. This is the number of relevant docs known by the judge for the measured query. -
getNumGoodPoints
public double getNumGoodPoints()Returns the number of good points (only relevant points). -
getNumPoints
public double getNumPoints()Returns the number of points (both relevant and irrelevant points). -
getRecallPoints
Returns the recallPoints. -
getMRR
public double getMRR()Returns the Mean reciprocal rank over the queries or RR for a single query.Reciprocal rank is defined as
1/r
wherer
is the rank of the first correct result, or0
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.
-
getSearchTime
public long getSearchTime()Returns the search time in milliseconds for the measured query.
-