Skip to main content

Explain precision and recall with an example.

Machine learning basics · Intermediate 2

Short answer

Precision is the share of items you flagged that were truly relevant; recall is the share of all relevant items that you found. A spam filter that flags only obvious spam has high precision but misses some spam, so lower recall. Which matters more depends on the cost of each kind of mistake.

Deeper answer

Precision = true positives / (true positives + false positives). Recall = true positives / (true positives + false negatives). Raising one often lowers the other, which is why F1, their harmonic mean, is used as a single number.

In retrieval for RAG, recall at k asks whether the chunk you needed was in the top k results, and precision asks how much of what you retrieved was useful. Missing the needed chunk (low recall) usually hurts answers more than retrieving a few extra chunks, so teams often tune for recall first, then rerank.

What a strong answer covers

Answer it out loud in the mock interview about 1 min

Follow-ups to expect

Common mistakes

Learn it

Choosing a metric

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.