Precision
What it is
Precision is the fraction of retrieved documents that are relevant to a query. It measures the purity of retrieval results: precision = (# relevant retrieved) / (# total retrieved). High precision indicates few false positives (irrelevant results). Precision is particularly important in user-facing IR systems where showing irrelevant results frustrates users.
[illustrate: Retrieved set with relevant (green) and irrelevant (red) results; precision calculation]
How it works
Formula:
Precision = (# relevant retrieved) / (# retrieved)
At rank k:
P@k = (# relevant in top-k) / k
Properties:
- Range: 0–1 (or 0–100%)
- High precision: few irrelevant results
- Trade-off: optimizing for precision often reduces recall
- Emphasis: quality over quantity of results
Example
Query: "best machine learning libraries"
Retrieved:
1. Scikit-learn tutorial (relevant)
2. Restaurant menu (irrelevant)
3. TensorFlow guide (relevant)
4. Sports news (irrelevant)
5. PyTorch documentation (relevant)
P = 3/5 = 0.6
P@3 = 2/3 = 0.67
P@1 = 1/1 = 1.0
Variants and history
Precision and recall are classical IR metrics (1950s–60s). Precision@k focuses on top results (practical for users who see only top-k). Mean Average Precision (MAP) averages precision across recall levels. Average Precision integrates precision-recall curve. Modern metrics (NDCG, MRR) incorporate ranking quality. Precision alone incomplete; combined with recall for holistic evaluation.
When to use it
Use precision when:
- User frustration with irrelevant results is costly
- Showing wrong answer worse than showing no answer
- High-precision retrieval is priority (Q&A, fact-checking)
- Limited result viewing (users see only top-k)
- Perfect recall unattainable or unnecessary
Precision is necessary but insufficient; balance with recall using F1 or MAP.