Definitionintro
Precision at k
Also called P@k.
The fraction of the top k retrieved documents that are relevant.
Precision at k, written P@k, is the number of relevant documents among the first k documents of a ranking, divided by k. It is the precision of the set that a user sees when the user reads the first k results and stops. It needs only the judgments of the top k documents, so it is cheap to measure, but it ignores the order inside the top k and every document below rank k. It is the simplest metric of ranked retrieval on a test collection.
Definition
Input. A ranking of distinct document ids for a query , with rank starting at 1, and graded judgments: for each document, with for a document that is not judged. A document is relevant when . Write when is relevant and otherwise. is the number of relevant documents in the judgments.
Value. For an integer cutoff ,
The parts of the definition, in the order of the metric pages of this area:
- Gain: binary. Grade 2 counts the same as grade 1. The threshold is a choice; trec_eval calls it the relevance level and sets it to 1 by default.
- Discount: none. Each of the first ranks has weight , and ranks after have weight 0.
- Normalization: division by . It is not division by and not by .
- Fewer than results: the missing ranks count as nonrelevant, so the divisor stays . This is the trec_eval rule (file m_P.c). A run that returns 4 documents of which 2 are relevant has P@10 = 2/10.
- Ties: the value depends on the order of documents with equal scores when a group of tied documents crosses rank . This area orders by score descending, then by document id ascending. trec_eval orders tied documents by document number in reverse lexical order (file form_res_rels.c), so the two rules can give different values from the same run file.
- No relevant documents (): P@k = 0 for every ranking. The value is defined, but it says nothing about the system, so a mean over queries usually leaves such a query out together with the queries that the other metrics cannot score.
Over a set of queries, mean P@k is the arithmetic mean of the values per query.
Bounds. . The upper bound holds because at most of the first documents are relevant, and it is reached by every ranking that puts relevant documents first. So when , no system can reach P@k = 1. On a query with , the best possible P@10 is 0.3.
Examples and non-examples
The fixed run on the toy collection
The shared toy collection of this area has 8 short documents. Query q1 is "sorted array search", with judgments d1 grade 2, d2 grade 1 and d8 grade 1, so . The fixed run gives the scores d1 2.0, d6 2.0, d8 1.5, d2 1.0, d4 1.0. With the tie rule of this area the ranking is 1, 6, 8, 2, 4, and .
| 1 | 2 | 3 | 4 | 5 | 10 | |
|---|---|---|---|---|---|---|
| relevant in top | 1 | 1 | 2 | 3 | 3 | 3 |
| P@k | 1 | 1/2 | 2/3 | 3/4 | 3/5 | 3/10 |
P@1 = 1/1 = 1 and P@3 = 2/3. P@10 = 3/10, because the run returns only 5 documents and the divisor stays 10. P@k goes down from rank 1 to rank 2 and up again from rank 2 to rank 4. P@k is not monotone in , but , the count of relevant documents seen, never decreases.
The same run with the other tie rule
d1 and d6 both score 2.0, and d2 and d4 both score 1.0. trec_eval puts the larger document number first inside each tie, so it reads the run as 6, 1, 8, 4, 2 with . Then P@1 = 0, P@2 = 1/2, P@3 = 2/3, P@4 = 2/4 = 1/2 and P@5 = 3/5. P@1 moves from 1 to 0 with no change in the scores. P@3 and P@5 do not change, because no tie group crosses rank 3 or rank 5.
The tie-aware value of McSherry and Najork (2008) is the mean of P@k over all orders of the tied documents. For P@1 the two orders of {d1, d6} give 1 and 0, so the tie-aware P@1 is 1/2. For P@3 the value is 2/3 in every order. They show that this mean has a closed form: inside a tie group that crosses rank , each position counts the fraction of relevant documents in the group.
Query q4
q4 is "quantum circuit". No query term occurs in the collection and . Every ranking has P@k = 0 for every .
Non-examples
- Precision of a set, , as on precision and recall. It has no cutoff and no order. P@k is the precision of the set of the first ranks; it equals set precision only when the run returns exactly documents.
- "Precision over the documents retrieved", that is, the count of relevant documents in the top divided by . For the run above with it gives 3/5, not 3/10. It rewards a run for returning fewer documents. It is not P@k.
- R-precision. It is precision at the cutoff , which differs from query to query. P@k uses one fixed for all queries.
- Recall at k, the count of relevant documents in the top divided by . For q1 at it is 1/3, while P@2 = 1/2.
Related definitions
- Average precision is the mean of P@k over the ranks of the relevant documents, with 0 for each relevant document that is not retrieved. It is sensitive to the order inside the top , which P@k is not.
- R-precision is P@R. At rank precision equals recall.
- Success at k (also called hit rate at k) is 1 if the top holds at least one relevant document and 0 otherwise. Its mean over queries is close in spirit to mean reciprocal rank.
- Normalized discounted cumulative gain uses the grades and a discount by rank, where P@k uses neither.
- Rank-biased precision replaces the hard cutoff by a geometric weight on each rank.
- The interpolated precision-recall curve uses the precision at every rank, not only at one cutoff.
Mean P@10 is a common report, but it is a noisy summary. Manning, Raghavan and Schuetze (Section 8.4) point out that it averages badly, because the number of relevant documents differs a lot from query to query, and a query with has a different scale from a query with . Buckley and Voorhees (2004, Table 3) measured the agreement between system rankings by MAP and by P(10) on three TREC collections with full judgments. The Kendall tau values were 0.813, 0.729 and 0.721, lower than for R-precision (0.916, 0.851 and 0.899). These are measurements on those collections. To claim that one system has a higher mean P@k than another, use a paired test over the queries, such as the sign test, the Wilcoxon signed-rank test or a permutation test, and give the number of queries and the p-value.
References
- Christopher D. Manning, Prabhakar Raghavan and Hinrich Schuetze, Introduction to Information Retrieval, Cambridge University Press, 2008, Chapter 8, Section 8.4 (precision at k, and why it does not average well over queries)
- trec_eval, the TREC evaluation program by Chris Buckley, maintained by NIST, file m_P.c (P_k divides by k also when fewer than k documents are retrieved) and file form_res_rels.c (tied scores are ordered by document number in reverse lexical order)
- Frank McSherry and Marc Najork, Computing information retrieval performance measures efficiently in the presence of tied scores, ECIR 2008, LNCS 4956, pp. 414-421, tie-aware precision, equal to the mean over all orders of the tied documents
- 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 P(10) on TREC-8, TREC-10 and TREC-12)
- Stefan Buettcher, Charles L. A. Clarke and Gordon V. Cormack, Information Retrieval, Implementing and Evaluating Search Engines, MIT Press, 2010, Chapter 12 (measuring effectiveness)
Where this leads
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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag 6CDHT4 Edit this page History Report an error Markdown