AI GLOSSARY · AI CONCEPTS

Precision and recall

Markdown version · Wikidata Q2359161

Definition

Precision and recall are two ways to score a classifier. Precision is the share of items it labelled positive that really are positive. Recall is the share of all real positives that it found.

Also called: precision recall, precision vs recall, recall machine learning, precision and recall in machine learning, precision versus recall.

In plain language

Suppose a spam filter flags 10 emails and 8 of them really are spam. Its precision is 8 out of 10. If your inbox held 16 spam emails in total, it found 8 of them, so its recall is 8 out of 16. Precision asks, when it raises an alarm, is it right. Recall asks, of everything it should have caught, how much did it catch. Raising one often lowers the other, so the right balance depends on which mistake costs more: missing a real problem or raising a false alarm. A single accuracy figure can hide this.

Technical definition

For a specified positive class, precision is TP/(TP+FP) and recall is TP/(TP+FN). State the decision threshold and label convention. A zero denominator makes the corresponding ratio undefined; software may return a configured value. Multiclass or multilabel reports require per-label values or an averaging convention. A precision-recall tradeoff is common, not a universal constraint.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Skill by Skill Almanac · Illustrative, not executed

    llm-eval-test-sets 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Builds and validates an eval dataset for any LLM feature, with a checker for duplicates, missing graders, imbalance and leakage.
    Why it exercises the concept
    The skill prepares labelled evaluation cases and checks balance. Precision and recall depend on the task's true positives, false positives and false negatives; preparing the dataset does not compute those metrics.
  2. Skill by Skill Almanac · Illustrative, not executed

    split-leakage-check 53/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Checks train, validation and test files for duplicates, shared groups, time and label leakage; prints JSON.
    Why it exercises the concept
    Leakage can inflate precision and recall on a test set. This skill checks the evaluation data for leakage rather than computing the metrics.
  3. Skill by Skill Almanac · Illustrative, not executed

    sample-size-calculator 41/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Computes the minimum number of subjects per group for a planned comparison of two proportions, two means, or one mean, using the normal approximation in a stdlib script.
    Why it exercises the concept
    A precision or recall figure from a small test set is noisy. Sample size planning is the nearby question of how many examples you need before comparing.
  4. Skill by Skill Almanac · Illustrative, not executed

    data-analysis-eda 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    A fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.
    Why it exercises the concept
    Profiling a labelled CSV shows how rare the positive class is, which affects how hard each of the two numbers is to move.

How it shows up when you use agents

Precision and recall appear whenever an agent or a model has to find something: flag risky code, route a ticket, spot a policy violation, retrieve the right documents. If a review agent flags 20 problems in a pull request and 15 are real, its precision is 15 out of 20. If the pull request held 30 real problems, its recall is 15 out of 30. The two numbers answer different questions, and an agent can look good on one and poor on the other.

What breaks when they are misunderstood: a team reports a high accuracy on a task where positives are rare, and a filter that flags nothing would score almost as well. Ask for both numbers, and ask which error is worse for the task. Missed security issues push you toward recall. Alert fatigue from false alarms pushes you toward precision.

A next step: build a small labelled set of real cases with LLM eval test sets, count true positives, false positives and false negatives by hand, and compute both metrics before you trust an agent's own claim. The same pair of terms is used for retrieval in retrieval-augmented generation, where recall asks whether the right passage was fetched.

Worked example (illustrative)

Use a constructed binary evaluation with TP=6, FP=9 and FN=4. Precision is 6/15=0.4 and recall is 6/10=0.6. If no items were predicted positive, precision would instead have a zero denominator and need an explicit software convention. The displayed counts are invented for explanation and were checked with scikit-learn, not measured from an agent or deployed classifier.

Common confusions

  • Precision versus recall. Precision looks at the items the model flagged. Recall looks at the real positives that exist. Their denominators differ.
  • Precision versus accuracy. Accuracy counts all correct calls, including negatives. It can look high when positives are rare. Precision and recall focus on the positive class.
  • Recall versus sensitivity. The scikit-learn guide notes recall is sometimes called sensitivity. For binary classification they name the same quantity.
  • Myth: improving one must always worsen the other. A better model can improve both, and precision need not move monotonically as a threshold changes. State the task, scores and operating threshold before comparing results.

Terms that mention Precision and recall

4 terms mention this one

More in AI concepts

Next steps

  1. llm-eval-test-sets A skill that exercises it.
  2. Classification Related term.
  3. Machine learning (ML) Related term.
  4. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.

Review record

Last verified

Drafted by Claude (original draft) and Codex (automated revisions); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-24. Last verified .

Change log (5)
  • : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
  • : Corrected bounded independent source-review finding; affected-claim re-review pending.
  • : First version.
  • : Metric and evaluation conventions corrected; independent exact-version review pending.
  • : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.