Overview
Accuracy is the share of all predictions a model or test got right. This works it out from a confusion matrix, along with precision, recall and the F1 score.
Enter the counts of true positives, false positives, true negatives and false negatives.
Worked examples
| Inputs | Result |
|---|---|
| True Positives84False Positives16True Negatives190False Negatives10 | Accuracy: 91.33%Precision: 84%Recall: 89.36%F1 score: 86.6% |
Show 2 more examples
| True Positives50False Positives10True Negatives30False Negatives10 | Accuracy: 80%Precision: 83.33%Recall: 83.33%F1 score: 83.33% |
| True Positives5False Positives1True Negatives989False Negatives5 | Accuracy: 99.4%Precision: 83.33%Recall: 50%F1 score: 62.5% |
Accuracy by true negatives
With the calculator's starting values, the accuracy is 91.33%. The table shows how it changes with the true negatives.
| True Negatives | Accuracy |
|---|---|
| 100 | 87.62% |
| 125 | 88.94% |
| 150 | 90% |
| 175 | 90.88% |
| 190starting value | 91.33% |
| 200 | 91.61% |
| 225 | 92.24% |
| 250 | 92.78% |
| 275 | 93.25% |
Other inputs: True Positives: 84 · False Positives: 16 · False Negatives: 10. Change them in the calculator above for your own numbers.
How it works
Accuracy is correct predictions divided by all predictions. Precision asks how many flagged cases were real, and recall asks how many real cases were flagged. F1 is the harmonic mean of precision and recall, so it is only high when both are.
The formula
| TP, TN | Correct positive and negative predictions |
| FP, FN | False alarms and missed cases |
Practical tips
- 84 TP, 16 FP, 190 TN and 10 FN give 91.33% accuracy, 84% precision, 89.36% recall and an F1 of 86.6%.
- Accuracy misleads on imbalanced data. With 5 positives in 1,000, a model that finds only half of them, with one false alarm, still scores 99.4% accuracy.
- When positives are rare, report precision and recall, not accuracy alone.
Frequently asked questions
What is a good accuracy score?
It depends on the baseline. Always compare with what you'd get by predicting the most common class every time.
What is the difference between accuracy and precision?
Accuracy covers every prediction. Precision covers only the positive predictions.
When should I use F1?
When false positives and false negatives both matter and the classes are uneven.