Accuracy
Accuracy is the most basic way to measure a classification model: the fraction of predictions it got right out of all predictions made.
Data & AI
Accuracy = correct predictions / total predictions. It's intuitive and easy to report, but it can be misleading on imbalanced data. If 99% of emails are not spam, a model that labels everything 'not spam' scores 99% accuracy while catching zero spam.
For that reason, accuracy is usually reported alongside precision, recall, and a confusion matrix to give a fuller picture of performance.
Examples
Python
from sklearn.metrics import accuracy_score
y_true = [1, 0, 1, 1]
y_pred = [1, 0, 0, 1]
print(accuracy_score(y_true, y_pred))Output:
0.75