Machine learning metric refresher

Never mix up accuracy, precision, recall, and F1 again.

Use the four questions below, then change the confusion matrix to see exactly what each metric rewards and misses.

The memory hook

Start with the question, not the equation.

Overall correctness

Accuracy

“How often is the model right?” It counts every correct prediction, both positives and negatives.

(TP + TN) / all cases
Trust positive alerts

Precision

“When it says yes, is it right?” High precision means few false alarms.

TP / (TP + FP)
Find actual positives

Recall

“Of all real yeses, how many did it find?” High recall means few misses.

TP / (TP + FN)
Balance the two

F1 score

“Is it both trustworthy and complete?” It balances precision and recall; a weak one pulls it down.

2PR / (P + R)

Make the metrics concrete

Edit any value. All results update instantly.

1

Model output

The model classifies

The model reviews 1,000 cases and labels each one as either positive or negative.

Predicted positive 100 The model said “yes”
Predicted negative 900 The model said “no”
2

Predictions vs reality

Build the confusion matrix

Reality
Model says Actually positive Actually negative
Positive
True positive (TP) Correctly said “yes”
False positive (FP) False alarm
Negative
False negative (FN) Missed a real positive
True negative (TN) Correctly said “no”
3

Performance scores

Calculate the metrics

Accuracy

Correct out of all cases

Precision

Positive alerts you can trust

Recall

Real positives found

F1 score

Balance of precision and recall

Enter values to see an interpretation.

Which metric matters most?

The cost of a mistake decides the priority.

False negatives are costly

Screening for disease

A missed illness can delay care. Favour recall: catch as many real cases as possible, then investigate the false alarms.

False positives are costly

Spam filtering

A false alarm can hide an important email. Favour precision: emails marked spam should very likely be spam.

Classes are imbalanced

Fraud detection

Most transactions are legitimate, so accuracy may be misleading. Use precision, recall, and F1 to judge fraud detection directly.

The one-minute cheat sheet

Keep this distinction in your head.

Metric Ask this Optimise it when...
Accuracy How often am I correct overall? Positive and negative classes are reasonably balanced and both error types matter similarly.
Precision Can I trust a positive prediction? False positives are expensive, disruptive, or damaging.
Recall Did I catch the real positives? False negatives are dangerous or costly.
F1 Is there a good balance between trust and coverage? You need one score for an imbalanced problem and both precision and recall matter.