🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
AI

Classification Accuracy Calculator — with baselines and a confidence interval

Turn correct predictions and total predictions into accuracy and error rate, then put a confidence interval around the figure and compare it against the baselines a trivial model would already reach.

The size of the evaluation set. This is what drives the width of the interval, and small test sets produce intervals that surprise people.
Two for a binary classifier. Used to compute what uniform random guessing would score.
The proportion of the test set belonging to the most common class. This is the accuracy of a model that always predicts that class and learns nothing.
The interval is a Wilson score interval, which stays sensible near 0% and 100% where the textbook normal interval falls apart.
Classification accuracy
 
0
Error rate
0
Majority baseline
0
Random baseline
0
Skill over baseline
Accuracy
Majority
Random
Skill score
Tip: the two baseline bars are the point of this page. An accuracy figure quoted without them is uninterpretable, because the reader cannot tell whether the model learned anything or simply discovered which class is most common.
Advertisement

A classification accuracy calculator looks like it should be a one-line division, and it is. The reason this page exists is everything that has to sit around that division before the answer means anything: how uncertain it is, what a model that learned nothing would have scored, and how many classes were on offer.

Arb Digital publishes a free tools library, and this page has two deliberate neighbours in its AI section. The confusion matrix calculator takes the four cells of a binary matrix and derives the full metric suite — precision, recall, specificity, F-beta and the Matthews correlation coefficient. This page does not do that. It works from correct-versus-total counts, handles any number of classes, and concentrates entirely on the accuracy figure itself: its interval and its baselines. The mean squared error calculator covers the equivalent question for regression, where predictions are numbers rather than labels and error is measured as a distance rather than as a count.

What This Classification Accuracy Calculator Does

It computes accuracy and error rate, then adds the three things that turn a bare percentage into a defensible claim.

A confidence interval. Accuracy is a proportion estimated from a sample, so it has a standard error. The tool computes a Wilson score interval rather than the normal approximation, because the normal interval misbehaves badly at high accuracy — it can produce upper bounds above 100%, which is exactly the region most model evaluations live in.

Two baselines. The majority-class baseline is what a model scores by always predicting the most common class. The random baseline is one divided by the number of classes. Any accuracy figure needs to be read against both, and against the higher of the two in particular.

A skill score. This normalises accuracy against the majority baseline: how much of the available headroom above the baseline the model actually captured. A model at 87% accuracy against a 62% baseline has captured 66% of what was available, which is a far more informative statement than 87%.

How to Use It

  1. Use the held-out test set, not the training set. Accuracy on data the model has seen is not an estimate of anything useful.
  2. Enter the real number of classes. It only affects the random baseline, but on a many-class problem that baseline is what tells you whether a modest-looking figure is actually strong.
  3. Find the majority class share honestly. Count the most common label in the test set and divide by the total. This is the number that most often deflates an impressive-looking accuracy.
  4. Look at the interval width before comparing models. If two models' intervals overlap heavily, the difference between them is not evidence of anything.
  5. Quote the skill score alongside the accuracy. It is harder to misread and much harder to game.

The Formula / How It's Calculated

Accuracy = correct ÷ total, and error rate = 1 − accuracy. For a multi-class problem this is the sum of the diagonal of the confusion matrix divided by the total, which is why it generalises to any number of classes without modification. These definitions match those in the scikit-learn documentation on metrics and scoring: quantifying the quality of predictions, which is the reference implementation most teams check against.

The Wilson score interval for a proportion p̂ from n observations at critical value z is centred at (p̂ + z² ÷ 2n) ÷ (1 + z² ÷ n) with a half-width of (z ÷ (1 + z² ÷ n)) × √(p̂(1 − p̂) ÷ n + z² ÷ 4n²). Unlike the simple normal interval it never runs outside 0 and 1, and it remains reasonable when accuracy is very high or the sample is small.

The baselines are the majority class share and 1 ÷ number of classes. The skill score is (accuracy − baseline) ÷ (1 − baseline) using the larger of the two, which reports the fraction of the available improvement over a trivial model that was actually achieved. It is zero for a model no better than the baseline and one for a perfect model.

Worked example, matching the values this page loads with. 870 correct out of 1,000, four classes, majority class 62%, at 95% confidence. Accuracy is 87.00% and error rate 13.00%. For the interval, z² is 3.8415, so the denominator is 1.0038, the centre is (0.87 + 0.00192) ÷ 1.0038 = 0.86859, and the half-width is 1.95246 × √(0.0001131 + 0.00000096) = 1.95246 × 0.010680 = 0.020852. The interval is therefore 84.77% to 88.94%. The majority baseline is 62% and the random baseline 25%, so the higher is 62%, and the skill score is (0.87 − 0.62) ÷ (1 − 0.62) = 0.25 ÷ 0.38 = 65.79%.

Advertisement

Why an Accuracy Figure Alone Means Nothing

The number 87% carries no information until you know what it is being compared against, and this is not a subtle statistical point — it routinely inverts the conclusion.

Google's machine learning crash course makes the case directly in its treatment of classification accuracy, recall and precision: on a heavily imbalanced dataset where one class appears just 1% of the time, a model that always predicts the majority scores 99% accuracy while detecting nothing at all. That model is useless, and its accuracy is higher than almost anything you will build on a balanced problem.

The worked example above is a gentler version of the same trap. An 87% accuracy sounds strong. Against a 62% majority baseline it is genuinely decent — the skill score of 66% says the model captured two thirds of the available headroom. Against a 96% baseline the identical accuracy would be a disaster, worse than doing nothing at all.

The rule that follows is simple and worth enforcing in any evaluation write-up: never report an accuracy figure without the class distribution beside it. If you cannot state what a majority-class predictor would score, you do not yet know whether your number is good.

How Wide Is the Interval, Really?

The second thing an accuracy figure hides is how much of it is noise, and the answer depends almost entirely on the size of the test set.

At 87% accuracy, a test set of 1,000 gives an interval roughly four percentage points wide. Shrink the test set to 200 and that interval roughly doubles; shrink it to 100 and a difference of five points between two models is well inside the noise. Because the interval width scales with the square root of the sample size, halving it requires four times as much test data — which is why teams that want to detect small improvements need much larger held-out sets than they expect.

Two practical consequences. First, a leaderboard difference smaller than the interval is not a result, and reporting it as an improvement is a common and avoidable error. Second, a single test set gives a single sample; cross-validation and reporting a spread across folds is the standard remedy, because it also captures variance from the train-test split itself, which no interval on one evaluation can see.

The sample size calculator will tell you how many examples you need to reach a given precision, and the standard error calculator covers the uncertainty on a proportion more generally.

When Accuracy Is the Wrong Metric Entirely

Three situations call for something else, and recognising them is more valuable than any refinement of the accuracy figure itself.

When the errors have unequal costs. Accuracy counts a false positive and a false negative identically. If one of them is far more expensive — a missed diagnosis against an unnecessary follow-up test, say — then a metric that weights them equally is measuring the wrong thing. Precision, recall and F-beta exist for this, and the confusion matrix calculator computes all of them from the four cells.

When the classes are severely imbalanced. Balanced accuracy, which averages recall across classes, and the Matthews correlation coefficient both survive imbalance far better, because neither can be inflated by a dominant class.

When the model outputs probabilities rather than labels. Accuracy requires a threshold, and the threshold is a choice you made rather than a property of the model. Metrics computed across all thresholds, or proper scoring rules that assess the probabilities directly, describe the model rather than one operating point.

Building an AI feature into a product?

Arb Digital designs and builds fast, dependency-free web interfaces around models — evaluation dashboards, calculators and tools that load instantly and rank.

See Web Design Services Talk to Arb Digital

Common Mistakes to Avoid

  • Reporting accuracy without the class distribution — the same figure can be excellent or catastrophic depending on what the majority baseline is.
  • Comparing models whose intervals overlap — a difference smaller than the confidence interval is noise, not an improvement.
  • Using the normal approximation for the interval — near 100% accuracy it produces upper bounds above one, which is exactly where model evaluations sit.
  • Measuring accuracy on the training set — it estimates memorisation rather than generalisation and is not comparable with anything.
  • Treating accuracy as sufficient on imbalanced data — balanced accuracy, F-beta or the Matthews correlation coefficient are the honest alternatives.

Related Free Tools From Arb Digital

The confusion matrix calculator derives precision, recall, F1 and MCC from the four cells of a binary matrix, and the mean squared error calculator covers regression error where predictions are numbers rather than labels. Use the sample size calculator to size a test set, the standard error calculator for uncertainty on a proportion, and the percentage calculator for the supporting arithmetic. Everything else is in the free online tools hub.

Frequently Asked Questions

How is classification accuracy calculated?

Correct predictions divided by total predictions. For a multi-class problem it is the sum of the diagonal of the confusion matrix divided by the total, which is why the same formula works for any number of classes without modification.

How is this different from the confusion matrix calculator?

That tool takes the four cells of a binary matrix and derives the full metric suite — precision, recall, specificity, F-beta and MCC. This page works from correct-versus-total counts for any number of classes and concentrates on the accuracy figure itself: its confidence interval and the baselines it should be compared against.

What is a good accuracy score?

There is no universal answer, because it depends entirely on the baseline. An accuracy of 87% is strong against a 62% majority-class baseline and worse than useless against a 96% one. Always read accuracy against what a model that learned nothing would score.

Why does the tool show a confidence interval?

Because accuracy is a proportion estimated from a sample and therefore carries uncertainty. On a test set of 1,000 the interval around 87% is about four percentage points wide, so any comparison between models that differ by less than that is reporting noise.

What is the skill score?

Accuracy minus the baseline, divided by one minus the baseline. It reports what fraction of the headroom above a trivial model was actually captured, so it is zero for a model no better than the baseline and one for a perfect model. It is much harder to misread than raw accuracy.

Why a Wilson interval rather than the normal one?

Because the normal approximation breaks down at extreme proportions, producing intervals that extend above 100% when accuracy is high — which is precisely where most model evaluations sit. The Wilson score interval stays inside 0 and 1 and behaves sensibly on small samples.

When should I stop using accuracy?

When the two kinds of error cost different amounts, when the classes are severely imbalanced, or when the model outputs probabilities and the threshold is a choice you made. In those cases precision, recall, balanced accuracy, MCC or a threshold-independent metric describe the model better.

This tool performs statistical arithmetic on counts you supply. It does not assess whether a model is fit for any particular purpose, and metrics from a classifier used in a medical, financial or safety context must be interpreted by someone qualified in that domain.

Advertisement
Advertisement

Take it further