Accuracy
“How often is the model right?” It counts every correct prediction, both positives and negatives.
(TP + TN) / all casesMachine learning metric refresher
Use the four questions below, then change the confusion matrix to see exactly what each metric rewards and misses.
Start with the question, not the equation.
“How often is the model right?” It counts every correct prediction, both positives and negatives.
(TP + TN) / all cases“When it says yes, is it right?” High precision means few false alarms.
TP / (TP + FP)“Of all real yeses, how many did it find?” High recall means few misses.
TP / (TP + FN)“Is it both trustworthy and complete?” It balances precision and recall; a weak one pulls it down.
2PR / (P + R)Edit any value. All results update instantly.
Model output
The model reviews 1,000 cases and labels each one as either positive or negative.
Predictions vs reality
| 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”
|
Performance scores
Correct out of all cases
Positive alerts you can trust
Real positives found
Balance of precision and recall
Enter values to see an interpretation.
The cost of a mistake decides the priority.
A missed illness can delay care. Favour recall: catch as many real cases as possible, then investigate the false alarms.
A false alarm can hide an important email. Favour precision: emails marked spam should very likely be spam.
Most transactions are legitimate, so accuracy may be misleading. Use precision, recall, and F1 to judge fraud detection directly.
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. |