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 classA certain rank in which a relevant doc was found. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber 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 TypeMethodDescriptionvoidaddResult(int n, boolean isRelevant, long docNameExtractTime) Add a (possibly relevant) doc.static QualityStatsaverage(QualityStats[] stats) Create a QualityStats object that is the average of the input QualityStats objects.doublegetAvp()Return the average precision at recall points.longReturns the time it took to extract doc names for judging the measured query, in milliseconds.doubleReturns the maximal number of good points.doublegetMRR()Returns the Mean reciprocal rank over the queries or RR for a single query.doubleReturns the number of good points (only relevant points).doubleReturns the number of points (both relevant and irrelevant points).doublegetPrecisionAt(int n) Return the precision at rank n: |{relevant hits within firstnhits}| /n.doubleReturn the recall: |{relevant hits found}| / |{relevant hits existing}|.Returns the recallPoints.longReturns the search time in milliseconds for the measured query.voidlog(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 firstnhits}| /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/rwhereris the rank of the first correct result, or0if 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.
-