Calculator Inputs
Choose one data format. Then enter ranked results and relevance data.
Formula Used
Precision@K measures relevance within the highest-ranked results. It focuses only on the selected cutoff. Higher values indicate more relevant top results.
Recall@K divides found relevant items by all relevant items. F1@K balances precision and recall together. Hit rate checks whether any relevant result appears.
How to Use
- Choose item IDs or binary relevance values.
- Select a single, batch, JSON, or CSV source.
- Enter one or several positive K values.
- Choose duplicate and strict-K handling options.
- Press the calculation button.
- Review tables, charts, warnings, and comparison metrics.
- Copy, print, or download the results.
Worked Example
The ranked predictions are A, B, C, D, E, and F. Relevant items are A, C, D, and G. The selected cutoff is five.
| Rank | Item | Relevant | Cumulative precision |
|---|---|---|---|
| 1 | A | Yes | 1.0000 |
| 2 | B | No | 0.5000 |
| 3 | C | Yes | 0.6667 |
| 4 | D | Yes | 0.7500 |
| 5 | E | No | 0.6000 |
Choosing K
Choose K using the visible result count. Search interfaces often show ten results. Recommendation panels may display fewer items.
Small K values test the strongest rankings. Larger K values test broader list quality. Compare several cutoffs before making decisions.
Applications and Limitations
Precision@K supports search, recommendation, retrieval, and ranking evaluation. It is simple and easy to explain. It also matches visible result lists.
The metric ignores result order within K. It can hide missed relevant items. Use recall, MAP, MRR, and nDCG alongside it.
Frequently Asked Questions
What does Precision@K measure?
It measures the relevant share among the top K predictions.
Can K exceed the prediction count?
Strict mode rejects that case. Available-results mode uses existing predictions.
How are duplicate predictions handled?
The calculator warns about duplicates. Unique mode removes repeated IDs.
What is macro Precision@K?
It averages query scores equally, regardless of query weight.
What is weighted Precision@K?
It gives larger weights more influence in the final average.
How does Precision@K differ from Recall@K?
Precision uses top-K results. Recall uses all known relevant items.
What is Hit Rate@K?
It equals one when any relevant result appears within K.
Why calculate MRR and nDCG?
They provide extra ranking sensitivity and early-result insight.
Can I evaluate multiple queries?
Yes. Use batch text, JSON, or a CSV file.