Evaluations and benchmarks

Precision

Also known as AI Precision, Precision measure

By WeavePublished Updated 2 min read

Definition

Precision is the fraction of positive predictions that are correct: true positives divided by the sum of true positives and false positives.

Formula

Precision = TP / (TP + FP)

TP means true positives: items the system correctly labels positive. FP means false positives: items it labels positive even though they are negative. Decide what counts as positive before evaluating a tool. For a bug detector, positive usually means that a real bug is present.

Code-review example

An AI reviewer flags 20 changes as buggy. A human checks the flags and confirms that 16 of those changes contain a bug. The remaining four are false alarms.

Its precision is 16 / 20 = 80%. This answers a practical question: how often does a flag deserve an engineer's attention? False alarms consume review time, so precision matters when choosing a review tool or setting its alert threshold.

Precision and recall

Recall measures how many actual positives the system finds. If the same evaluation contains 40 buggy changes, finding 16 gives 16 / 40 = 40% recall. The reviewer can therefore have good precision while missing most buggy changes.

Report both measures for the same dataset and threshold. F1 score combines them when a single summary is useful. For multiple classes, state whether precision is calculated per class or averaged, and which averaging method is used.

Comparing results

Use the same labeled examples for each tool. Keep the counts visible, check disagreements, and report the number of reviewed cases. If there are no positive predictions, the formula's denominator is zero; state the evaluation's convention rather than reporting an unexplained perfect score.

How this relates to Weave

Review an AI code-review tool's precision alongside engineering output and code-quality trends. Weave Code Intelligence analyzes pull requests, giving teams context for deciding whether automation improves the work they ship.

Explore Code intelligence

Sources and further reading

  1. scikit-learn: precision_score
  2. Weave Code Intelligence