Classification Accuracy
Fraction of predictions that are correct.
Formula
Live Calculator
MembersVariables
Example
(90+5)/(100) = 0.95 = 95% accuracy
How it works
Classification accuracy measures how often a classifier is right overall. It adds the cases it got correct: true positives and true negatives, then divides by all predictions made, so the result is the share of predictions that matched the true labels. This works because every prediction falls into exactly one of four categories: correct positive, correct negative, false positive, or false negative.
When to use it
Use accuracy when you want a quick summary of overall performance for a classification model, especially when the classes are fairly balanced. It is common in tasks like spam detection, disease screening, image labeling, and any binary or multiclass prediction problem where you care about the fraction correct.
Worked example, step by step
Suppose a model makes 200 predictions. TP = 72, TN = 108, FP = 12, FN = 8 Accuracy = (TP + TN) / (TP + TN + FP + FN) Accuracy = (72 + 108) / (72 + 108 + 12 + 8) Accuracy = 180 / 200 Accuracy = 0.90 Accuracy = 90%
Common mistakes to avoid
- Using accuracy alone even when one class is very rare, which can hide poor performance on the minority class
- Swapping false positives and false negatives when counting the confusion matrix
- Forgetting that the denominator is the total number of predictions, not just the correct ones
Did You Know?
Accuracy is misleading on imbalanced datasets.
Share this formula
More in Data Science & ML
View allMean Squared Error (MSE)
BasicAverage of squared differences between predicted and actual values.
Root Mean Squared Error (RMSE)
BasicSquare root of MSE, in the same units as the target variable.
Mean Absolute Error (MAE)
BasicAverage of absolute differences between predictions and actual values.
Coefficient of Determination (R²)
IntermediateProportion of variance in the target explained by the model.
Precision
IntermediateOf all positive predictions, the fraction that were correct.
Recall (Sensitivity)
IntermediateOf all actual positives, the fraction correctly identified.