The number of correct classification predictions divided by the total number of predictions. That is:
![]()
For example, a model that made 40 correct predictions and 10 incorrect predictions would have an accuracy of:
![]()
Binary classification provides specific names for the different categories of correct and incorrect predictions. So the accuracy formula for binary classification is as follows:
where:
- TP is the number of True Positives (correct predictions).
- TN is the number of True Negatives (correct predictions).
- FP is the number of False Positives (incorrect predictions).
- FN is the number of False Negatives (incorrect predictions).
Compare accuracy with precision and recall.
Although it is a valuable metric in some situations, accuracy is highly misleading in others. Notably, accuracy is usually a poor metric for evaluating classification models that process class-imbalanced datasets.
For example, suppose snow falls only 25 days per century in a certain subtropical city. Since days without snow (the negative class) far outnumber days with snow (the positive class), the snow dataset for this city is class-imbalanced. Imagine a binary classification model that is supposed to predict either snow or no snow each day, but simply predicts “no snow” every day. This model is highly accurate but has no predictive power. The following table summarizes the results for a century of predictions:

So the accuracy of this model is:
accuracy = (TP + TN) / (TP + TN + FP + FN)
accuracy = (0 + 36500) / (0 + 36500 + 25 + 0) = 0.9993 = 99.93%
Although an accuracy of 99.93% seems very impressive, the model actually has no predictive power.
Precision and recall are usually more useful metrics than accuracy for evaluating models trained on class-imbalanced datasets.
Browse the book
Cite this book
Taima, Alaa. (2022). Accuracy. Deep Learning in Arabic. https://dlarabic.com/en/articles/accuracy/
@book{taimaa2022_1476,
title = {Accuracy},
author = {Taima, Alaa},
year = {2022},
publisher = {Deep Learning in Arabic},
url = {https://dlarabic.com/en/articles/accuracy/},
language = {arabic}
}

