SOLVETUTORMATH SOLVER

Instrument MI-07-013 · Statistics

Accuracy Calculator

Feed in the four cells of a confusion matrix and this instrument reads out the one number every classifier report leads with: the share of predictions that were simply correct.

Instrument MI-07-013
Sheet 1 OF 1
Rev A
Verified
Type 07 — Classification Metrics SER. 2026-07013

Accuracy

0.842105

accuracy = (TP+TN) / (TP+TN+FP+FN)

The working Every figure verified twice
  1. acc = (50 + 30) ⁄ (50 + 30 + 10 + 5) = 0.842105
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Accuracy is the fraction of a classifier's predictions that were correct, taken over every prediction it made. Split any binary classifier's output into a confusion matrix — true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN) — and accuracy is just the two correct cells, TP and TN, divided by all four cells added together. It answers the plainest possible question: out of everything the model called, how much did it get right?

That plainness is also accuracy's limitation. Because it treats every prediction equally, accuracy can look excellent on a lopsided data set even when the classifier is nearly useless. A model that always predicts 'negative' on a test where 95% of cases really are negative scores 95% accuracy while catching zero positives — which is exactly why accuracy is normally read alongside sensitivity, specificity, or a single balanced score like Matthews correlation coefficient or Youden's J, not in isolation.

Accuracy earns its place regardless: on a data set where positives and negatives are reasonably balanced, it is the fastest way to summarise how a spam filter, a defect detector, or a diagnostic screen is performing overall, and it is the number most dashboards and papers report first before drilling into the class-by-class detail.

Accuracy=TP+TNTP+TN+FP+FN\text{Accuracy} = \dfrac{TP + TN}{TP + TN + FP + FN}
TP — true positives · FP — false positives · TN — true negatives · FN — false negatives · accuracy is the correct predictions (TP+TN) divided by all predictions made.
  • Enter the count of correctly flagged positive cases into True positives (TP).
  • Enter the count of negative cases wrongly flagged as positive into False positives (FP).
  • Enter the count of correctly cleared negative cases into True negatives (TN).
  • Enter the count of positive cases wrongly cleared as negative into False negatives (FN).
  • Read Accuracy — the share of all four counts that landed in the two correct cells, TP and TN.
  • If every field reads zero the instrument has nothing to divide and will ask for at least one nonzero count before it computes a result.

Worked example — a 95-case test set confusion matrix

Enter TP = 50, FP = 10, TN = 30, FN = 5. The correct predictions are TP + TN = 50 + 30 = 80, and the total number of predictions is 50 + 10 + 30 + 5 = 95. Accuracy reads 0.842105 — about 84.21% of the 95 cases were classified correctly.

The other 15 cases split into two different kinds of mistake: 10 false positives (negative cases wrongly flagged) and 5 false negatives (positive cases wrongly cleared). Accuracy alone doesn't say which error type dominates — that's what the sensitivity and specificity instruments on this site are for, using the same four counts entered here.

Questions

Why is high accuracy sometimes a bad sign for a classifier?

Because accuracy weights every prediction equally, a classifier tested on an imbalanced data set can score high accuracy purely by favouring the majority class. If 95 of 100 cases are truly negative, a model that predicts 'negative' every single time scores 95% accuracy while catching zero of the real positives. That's why accuracy should be read together with sensitivity (does it catch the positives?) and specificity (does it correctly clear the negatives?) rather than trusted alone, especially for rare-event detection like fraud or disease screening.

What's the difference between accuracy and Matthews correlation coefficient?

Accuracy is a simple ratio of correct predictions to all predictions, and it can be misleadingly high on imbalanced data. Matthews correlation coefficient (MCC) folds all four confusion-matrix cells into a single correlation-style score from -1 to +1 that stays meaningful even when the classes are very unequal in size, because a classifier that ignores the minority class entirely no longer scores well on MCC the way it can on accuracy. This site's MCC instrument uses the same TP, FP, TN, FN inputs as this one.

Can accuracy be negative or over 100%?

No. Accuracy is a ratio of a count of correct predictions to a count of total predictions, so it is always between 0 (nothing was classified correctly) and 1, or 0% to 100%. A result of exactly 1.0 means every single prediction — both the positive calls and the negative calls — matched the true label.

Do TP, FP, TN and FN have to come from a machine-learning model?

No — the confusion matrix behind this formula applies to any binary classification process: a medical screening test, a spam filter, a quality-control inspection, or a search algorithm's relevant/irrelevant calls. Anywhere predictions get sorted into 'positive' or 'negative' against a known true outcome, the same four counts and the same accuracy formula apply.

What accuracy counts as 'good'?

There's no universal threshold — it depends entirely on the class balance and the cost of each error type. On a perfectly balanced 50/50 data set, 90% accuracy is a strong result. On a data set that's 99% one class, 99% accuracy is what you'd get by guessing the majority class every time, so it says almost nothing about the classifier's real skill. Always check the class split before judging an accuracy figure.

References