Accuracy is the proportion of predictions that a model gets exactly right, calculated as the number of correct predictions divided by the total number of predictions. In model evaluation, it is the most intuitive metric for classification, also called classification accuracy, and it is usually reported as a value between 0 and 1 or as a percentage.
Accuracy answers a single question: how often is the model correct overall? It is easy to explain and compare, but it treats every error as equally costly and hides how errors are distributed across classes. For that reason, experienced practitioners rarely rely on accuracy alone.
How accuracy is calculated
For binary classification, accuracy is derived from the four cells of the confusion matrix: true positives (TP), true negatives (TN), false positives (FP) and false negatives (FN). The formula is (TP + TN) / (TP + TN + FP + FN). For multiclass problems, accuracy is simply the sum of the diagonal of the confusion matrix divided by the total count.
The table below shows the confusion matrix terms that feed into accuracy and the other metrics built from the same counts.
| Term | Meaning | Counted as correct |
|---|---|---|
| True positive | Positive case predicted positive | Yes |
| True negative | Negative case predicted negative | Yes |
| False positive | Negative case predicted positive | No |
| False negative | Positive case predicted negative | No |
Accuracy depends on the decision threshold that converts a model score into a class. A classifier that outputs probabilities usually applies a threshold of 0.5 by default, but moving the threshold changes accuracy, precision and recall simultaneously. Threshold-free metrics such as AUC of the ROC curve exist precisely to evaluate ranking quality independently of that choice.
The accuracy paradox and class imbalance
The best-known weakness of accuracy is the accuracy paradox: on imbalanced data, a useless model can achieve a very high score. If only 1 percent of transactions are fraudulent, a model that labels everything as legitimate reaches 99 percent accuracy while catching no fraud at all.
For this reason, accuracy should always be compared with a baseline, typically the share of the majority class. The improvement over that baseline, not the raw number, shows whether the model has learned anything useful. Corrected variants address the problem directly, as summarized below.
| Variant | Definition | When to use |
|---|---|---|
| Standard accuracy | Correct predictions over all predictions | Balanced classes, equal error costs |
| Balanced accuracy | Average of recall across classes | Imbalanced classes |
| Top-k accuracy | True class among k highest scores | Many classes, ranked suggestions |
| Exact match accuracy | Entire output must match the reference | Multi-label or generated answers |
| Cohen’s kappa | Agreement corrected for chance | Comparing against chance level |
Accuracy compared with precision, recall and F1
Accuracy summarizes all errors together, while precision, recall and F1 score separate them. Precision measures how many positive predictions were correct; recall measures how many actual positives were found; F1 is their harmonic mean. When false positives and false negatives have different costs, these metrics are more informative than accuracy.
| Metric | Question it answers | Main weakness |
|---|---|---|
| Accuracy | How often is the model right overall | Misleading under imbalance |
| Precision | How trustworthy are positive predictions | Ignores missed positives |
| Recall | How many positives are found | Ignores false alarms |
| F1 score | Balance of precision and recall | Ignores true negatives |
| AUC | How well scores rank cases | Does not reflect a chosen threshold |
In the evaluation of large language models, accuracy appears in a different form: many AI benchmarks report the share of multiple-choice or short-answer questions answered correctly. Here accuracy is meaningful only when the evaluation dataset is uncontaminated and the answer format is strictly checked, because a small parsing change can shift scores noticeably.
Using accuracy correctly
Accuracy is a sound choice when classes are roughly balanced and errors cost about the same, for example in digit recognition or topic classification with evenly distributed categories. It is also useful as a headline number for non-specialist audiences, provided the baseline is stated alongside it.
| Situation | Recommended metric | Reason |
|---|---|---|
| Balanced classes | Accuracy | Simple and representative |
| Rare positive class | Recall, precision or PR AUC | Accuracy rewards ignoring positives |
| Costly false alarms | Precision | Errors of one type dominate |
| Costly misses | Recall | Missed cases are the main risk |
| Model comparison across thresholds | ROC AUC | Independent of a single threshold |
Reliable accuracy estimates require held-out data that the model never saw during training. Cross-validation gives a more stable estimate on small datasets, and reporting a confidence interval prevents over-interpreting differences of a fraction of a percentage point.
Common mistakes with accuracy
Misuse of accuracy usually comes from reading the number without its context. The following mistakes appear regularly in reports and model comparisons.
- Reporting training accuracy instead of test accuracy, which hides overfitting.
- Omitting the majority-class baseline, so a high score looks better than it is.
- Comparing accuracy across datasets with different class distributions.
- Ignoring sample size, so small test sets produce unstable figures.
- Tuning on the test set, which inflates accuracy and invalidates the final evaluation.
A subtler mistake is treating accuracy as a property of the model alone. It is a property of the model, the threshold and the data distribution together. When the share of positive cases changes in production, a phenomenon known as prior shift, accuracy changes even if the model itself is unchanged. Monitoring accuracy over time therefore requires tracking the class distribution as well, and recalculating the baseline whenever that distribution moves.
Finally, accuracy says nothing about calibration, that is, whether a predicted probability of 0.8 is correct about 80 percent of the time. Two models with identical accuracy can differ widely in how trustworthy their confidence scores are, which matters whenever downstream decisions use those scores.
The simple explanation
Accuracy is the percentage of answers a model gets right, like a score on a school test. If a model makes 100 predictions and 90 are correct, its accuracy is 90 percent.
The catch is that the score can flatter a lazy model. If almost every answer on the test is the same, guessing that answer every time earns a high score without any real understanding. High accuracy only means something when compared with simple guessing.
How it is used in practice
A hospital data team builds a model to flag chest X-rays that may show pneumonia. In their test set of 2,000 images, only 200 are positive. The first model reports 90 percent accuracy, which sounds strong until the team notices that labeling every image as healthy would also score 90 percent.
They switch to reporting recall, precision and balanced accuracy. The improved model finds 180 of the 200 positive cases, a recall of 90 percent, with an acceptable number of false alarms that radiologists review. Its plain accuracy rises only modestly, but the clinical value is far higher, because the metric now reflects the cost of missing a sick patient.