Algorithm Search⌘K

Definitioncore

R-precision

Also called R-prec.

Precision at rank R, where R is the number of relevant documents for the query; it equals recall at that rank.

R-precision is the precision of the first R documents of a ranking, where R is the number of relevant documents for the query. It is precision at k with a cutoff that each query sets for itself. At that one rank precision and recall have the same value, so R-precision is also the recall at rank R. A perfect ranking scores 1 on every query, which P@k with a fixed k cannot promise.

Definition

Input. A ranking d(1),…,d(n)d_{(1)}, \ldots, d_{(n)} of nn distinct document ids for a query, with ranks starting at 1, and graded judgments g(d)∈{0,1,2,…}g(d) \in \{0, 1, 2, \ldots\}, where a document that is not judged has g(d)=0g(d) = 0. A document is relevant when g(d)≥1g(d) \ge 1, and reli=1\mathrm{rel}_i = 1 when d(i)d_{(i)} is relevant. RR is the number of relevant documents in the judgments, retrieved or not.

Value. When R≥1R \ge 1,

Rprec=1R∑i=1min⁡(R,n)reli.\mathrm{Rprec} = \frac{1}{R} \sum_{i=1}^{\min(R, n)} \mathrm{rel}_i .
  • Gain: binary, with the threshold g≥1g \ge 1. The grades above 1 are not used.
  • Discount: none. The first RR ranks have weight 1/R1/R each, and the ranks after RR have weight 0.
  • Normalization: division by RR. When the run has fewer than RR documents, the missing ranks count as nonrelevant and the divisor stays RR. trec_eval does the same (file m_Rprec.c).
  • Cutoff: k=Rk = R. The cutoff is a property of the query and its judgments, not a parameter of the metric.
  • Ties: a group of tied scores that crosses rank RR can change the value. This area orders by score descending, then by document id ascending. trec_eval orders tied documents by document number in reverse lexical order, so the two can disagree on the same run file.
  • No relevant documents (R=0R = 0): undefined, because the cutoff and the divisor are both 0. Return None and leave the query out of the mean. trec_eval does not do this: for a query that is in its judgments file with no relevant document, it reports 0 and counts the query in the mean.

Mean R-precision over a set of queries is the arithmetic mean over the queries with R≥1R \ge 1.

Claim 1. R-precision equals recall at rank RR.

Proof. Let rr be the number of relevant documents in the first min⁡(R,n)\min(R, n) ranks. Precision at rank RR, with the missing ranks counted as nonrelevant, is r/Rr/R. Recall at rank RR is the number of relevant documents in the first RR ranks divided by the number of relevant documents, which is r/Rr/R. The two are the same number. □\square

Claim 2. Let r(k)r(k) be the number of relevant documents in the first kk ranks, P(k)=r(k)/kP(k) = r(k)/k and rec(k)=r(k)/R\mathrm{rec}(k) = r(k)/R. If r(k)≥1r(k) \ge 1, then P(k)=rec(k)P(k) = \mathrm{rec}(k) holds exactly when k=Rk = R.

Proof. With r(k)≥1r(k) \ge 1, the equation r(k)/k=r(k)/Rr(k)/k = r(k)/R divides through to k=Rk = R. □\square

So rank RR is the only rank where the precision and the recall of a ranking can meet with a nonzero value. Manning, Raghavan and Schuetze (Section 8.4) relate R-precision to the break-even point of the precision-recall curve, where the two are equal.

Claim 3. 0≤Rprec≤10 \le \mathrm{Rprec} \le 1, and Rprec=1\mathrm{Rprec} = 1 exactly when the first RR ranks hold only relevant documents.

Proof. The sum has at most RR terms, each 0 or 1, so it lies between 0 and RR. It equals RR exactly when n≥Rn \ge R and every one of the first RR documents is relevant. □\square

P@k does not have this property: on a query with R=3R = 3, no ranking reaches P@10 above 3/10, while every ranking that puts the 3 relevant documents first reaches R-precision 1.

Examples and non-examples

The fixed run on the toy collection

On the toy collection of this area, query q1 "sorted array search" has the relevant documents d1 (grade 2), d2 and d8 (grade 1), so R=3R = 3. The fixed run, with the tie rule of this area, ranks 1, 6, 8, 2, 4. The first three ranks hold d1 and d8, which are relevant, and d6, which is not. So Rprec=2/3\mathrm{Rprec} = 2/3. Recall at rank 3 is also 2/32/3: two of the three relevant documents are found.

The run has two tie groups, {d1, d6} at ranks 1 and 2 and {d2, d4} at ranks 4 and 5. Neither group crosses rank 3, so the trec_eval order 6, 1, 8, 4, 2 gives the same value 2/32/3. P@1 on the same run changes from 1 to 0 under the other tie rule.

A run that ranks 1, 2, 8, 7, 4 puts all three relevant documents first and has Rprec=1\mathrm{Rprec} = 1.

Several queries

Query RR Ranking First RR ranks Rprec
q1 3 1, 6, 8, 2, 4 d1, d6, d8 2/3
q2 "posting list merge" 3 8, 5, 1, 4, 2 d8, d5, d1 1/3
q3 "rank documents" 1 2, 6, 7, 1, 5 d2 0
q4 "quantum circuit" 0 1, 2, 3, 4, 5 none None

For q2 the relevant documents are d5, d4 and d3. Only d5 is in the first 3 ranks, so the value is 1/3, though d4 comes at rank 4. For q3 the only relevant document is d7, at rank 3, which is after the cutoff R=1R = 1, so the value is 0. q4 has no relevant document, so it is left out, and mean R-precision is (2/3+1/3+0)/3=1/3(2/3 + 1/3 + 0)/3 = 1/3.

A short run

If the run for q2 returns only d8 and d5, it has n=2<R=3n = 2 < R = 3. The sum covers the first 2 ranks and finds one relevant document, so Rprec=1/3\mathrm{Rprec} = 1/3, the same as before.

Non-examples

  • Dividing by min⁡(R,n)\min(R, n) instead of RR. For the short run above it gives 1/2, and it rewards a system for returning fewer documents. That is not R-precision.
  • P@3 on all queries. On q1 it agrees with R-precision because R=3R = 3, but on q3 (R=1R = 1) P@3 is 1/3 and R-precision is 0.
  • The break-even point read from an interpolated precision-recall curve. Interpolation takes a maximum over later ranks, so the interpolated curve can meet the diagonal at a different value.
  • Precision at k fixes one cutoff for all queries. R-precision is P@R.
  • Average precision averages the precision at every relevant rank. Both are normalized by RR, and a ranking scores 1 on both exactly when all relevant documents come first.
  • Bpref also uses RR to bound how many nonrelevant documents it counts, and is built for incomplete judgments.
  • The value of RR comes from the judgments, so it depends on how the test collection was judged. With pooling, RR counts only the relevant documents that some system found, and the cutoff moves when the pool grows.

Buckley and Voorhees (2004, Table 3) compared the system rankings by MAP with the rankings by other measures on TREC-8, TREC-10 and TREC-12 with full judgments. For R-precision the Kendall tau values were 0.916, 0.851 and 0.899, and for P(10) they were 0.813, 0.729 and 0.721. This is a measurement on those collections, not a property of the definition. A claim that one system has a higher mean R-precision than another needs a paired test over the queries, for example a permutation test or the Wilcoxon signed-rank test.

References

  1. Christopher D. Manning, Prabhakar Raghavan and Hinrich Schuetze, Introduction to Information Retrieval, Cambridge University Press, 2008, Chapter 8, Section 8.4 (R-precision, and its relation to the break-even point)
  2. trec_eval, the TREC evaluation program by Chris Buckley, maintained by NIST, file m_Rprec.c (counts the relevant documents in the first MIN(num_ret, num_rel) ranks and divides by num_rel; returns 0 when that minimum is 0)
  3. Common Evaluation Measures, appendix to the TREC 2006 proceedings, NIST, section on R-precision
  4. Chris Buckley and Ellen M. Voorhees, Retrieval evaluation with incomplete information, SIGIR 2004, pp. 25-32, Section 3, Table 3 (Kendall tau between the system rankings by MAP and by R-precision on TREC-8, TREC-10 and TREC-12)
  5. Ellen M. Voorhees and Donna K. Harman (editors), TREC, Experiment and Evaluation in Information Retrieval, MIT Press, 2005, Chapter 3, Chris Buckley and Ellen M. Voorhees, Retrieval system evaluation, pp. 53-75

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/EJW2ZW/text.yaml