Skip to content
AI.info

Evaluation

Accuracy, Balanced Accuracy, and Averaging

Understand when accuracy is informative, how class imbalance changes interpretation, and what macro, micro, weighted, and sample averaging actually prioritize.

By the end you can

Example

Ninety-three percent correct, and two thirds of the class missed

Sepsis occurred in 2,552 of 38,455 hospitalizations, across 27,697 patients. That is 7%. The figure comes from an external validation of the Epic Sepsis Model, published by Wong and colleagues in JAMA Internal Medicine in 2021. A base rate that low settles what a bare accuracy figure can be worth here, before anyone fits a model.

  • Always-negative predictor: answer no sepsis for every one of the 38,455 hospitalizations and, at a 7% base rate, you are right about almost all of them. You also detect none of the 2,552 cases. The safety function the model exists for fails entirely.
  • Balanced accuracy: average the recall over the two classes and you get 50%. That is the chance-level figure a high overall accuracy conceals.
  • The deployed model: an AUC of 0.63, alerts on 18% of hospitalizations, and at threshold 6 a sensitivity of 33% against a positive predictive value of 12%. It failed to identify 1,709 of the sepsis patients — 67% of the class it exists to catch.
  • A second validation, the same shape: Ostermayer and colleagues ran the model across 145,885 emergency-department encounters in two county emergency departments and measured a sensitivity of 14.7%, a specificity of 95.3% and a positive predictive value of 7.6% (JAMIA Open, 2024).

What accuracy does and does not weight

Accuracy gives equal weight to each evaluated observation. It does not give equal weight to each class, person, site, or type of consequence. When classes are balanced and errors have similar costs, accuracy can be clear and useful. Under imbalance or asymmetric stakes, it may mostly describe the dominant class.

Two teams once agreed on the aggregate and disagreed about everything underneath it. ProPublica analysed COMPAS scores for Broward County defendants in May 2016 and found the tool correctly predicted recidivism 61 percent of the time overall. The errors underneath that number were not alike. “In forecasting who would re-offend, the algorithm made mistakes with black and white defendants at roughly the same rate but in very different ways,” the reporters wrote. Among defendants who did not re-offend, 44.9% of black defendants had been labelled higher risk, against 23.5% of white defendants. Among those who did re-offend, 47.7% of white defendants had been labelled lower risk, against 28.0% of black defendants. A rejoinder in Federal Probation re-analysed the same data later that year and reported AUCs of .71 overall, .69 for white and .70 for black defendants, with no significant difference by race. Both readings are arithmetically correct. The aggregate is level across the two groups and the composition of the errors is not. Only one of those two facts fits inside a single number.

Balanced accuracy has rivals, and they do not always agree. A 2021 paper in BioData Mining set it beside the Matthews correlation coefficient, along with bookmaker informedness and markedness, and found cases where the measures disagree. A coefficient close to +1, the authors note, “means having high values for all the other confusion matrix metrics.” “The same cannot be said for balanced accuracy,” they write. They also describe “three exceptions where BM can be more appropriate”, the first of them “analyzing classifications where dataset prevalence is unrepresentative”. High on one summary measure is not high on all of them.

Equal weight per row is not equal importance per outcome.

Comparison

Four averaging policies

Aggregation choices encode different priorities, and which one you used is a reporting fact rather than a matter of taste. An international standard treats it that way. ISO/IEC TS 4213:2022, on assessing machine learning classification performance, gives averaging a normative clause of its own: 6.4.3, “Macro-average, weighted-average and micro-average”. Its introduction says why a reader needs that clause at all: “If a classifier is susceptible to majority class classification, grossly unbalanced training data can overstate accuracy by representing the prior probabilities of the majority class.” Three of the four policies below are named and numbered in a published international standard. Report a bare average without saying which one produced it and you have dropped something the standard counts as part of the result.

FigureComparison · 4 columns

Micro average

Pool decisions before computing the metric.

  • Weights frequent classes heavily
  • Matches global event counts
  • Useful for overall throughput
  • Can hide rare classes

Macro average

Compute each class metric, then average equally.

  • Each class has equal weight
  • Highlights rare-class failure
  • Can be noisy with tiny support
  • Ignores prevalence in weighting

Weighted macro

Weight each class metric by its support.

  • Reflects observed prevalence
  • Smoother for rare classes
  • May resemble micro results
  • Still depends on sample mix

Sample average

Compute a metric per example, then average.

  • Common in multilabel tasks
  • Weights examples equally
  • Sensitive to label cardinality
  • Different from class averaging

Visual

Balanced accuracy is mean recall across classes

It asks whether each reference class is recognized, not whether every row is equally common. Compute the recall for each class against that class's own support. Average the recalls without using prevalence as the weight. Report the class counts and the uncertainty beside the average. Then look at the confusion matrix, because the same balanced figure can sit on top of very different error patterns.

FigureProcess · 4 steps
  1. 1. Compute class recall

    For each class, divide correct predictions by that class’s support.

  2. 2. Give classes equal weight

    Average the recalls without using prevalence as the weight.

  3. 3. Interpret with support

    Report class counts and uncertainty beside the average.

  4. 4. Inspect the matrix

    Check whether the same average hides different confusion patterns.

Key idea

Subset accuracy is unusually strict

In multilabel classification, subset accuracy requires the entire predicted label set to exactly match the reference set for each example. One missing or extra label makes that example incorrect.

This can be appropriate when the complete set is the product contract. It should not be mistaken for per-label accuracy or Hamming-style performance. ISO/IEC TS 4213:2022 keeps the two events apart in its numbering: multi-label classification gets clause 6.5.3, “Exact match ratio”, separately from the multiclass averaging of clause 6.4.3. The word printed on the dashboard can be the same in both cases. The event being counted is not.

The word “accuracy” can refer to different events in multiclass and multilabel settings.

Analogy

A school average dominated by one enormous class

Exam results averaged across a school where one class contains 9,000 students and every other class contains 20 depend entirely on what is being averaged over. A student-weighted average mostly reflects the largest class. A class-weighted average answers a different question.

Neither is wrong until the question is stated. The averaging rule decides whose performance dominates the summary. That is a decision about who counts, taken in the notation rather than in the discussion.

An average is a weighting choice disguised as arithmetic.

Do not ask one average to carry every subgroup

Macro averaging across classes does not guarantee fairness across people, sites, or time. A model can recognize each label adequately overall while failing one hospital or one language.

The largest published demonstration of this is a government evaluation. NIST ran 18.27 million images of 8.49 million people through 189 algorithms from 99 developers and published the result in December 2019 as Face Recognition Vendor Test Part 3: Demographic Effects. The finding in the executive summary is stated as a range, not as an average: “Across demographics, false positives rates often vary by factors of 10 to beyond 100 times.” One class of error moved by up to two orders of magnitude between groups, inside evaluations that also produce a single headline number. The U.S. Government Accountability Office restated the result in the plainest possible terms: white males had the lowest false positive rate and black females the highest.

Use class averages for class questions and slice reports for population questions. Keep the aggregation dimension explicit in charts and tables.

Averaging over labels cannot substitute for averaging over populations.

Case

0.8% and 34.7% inside the same accuracy figure

Three commercial gender classifiers were tested on the same faces, and the error rate depended on whose face it was. Darker-skinned females were “the most misclassified group,” with error rates of up to 34.7%; across the three products the darker female error rates ran from 20.8% to 34.7%. “The maximum error rate for lighter-skinned males is 0.8%.” On lighter male faces, Microsoft's error rate was 0.0% and IBM's 0.3%. Buolamwini and Gebru published the audit in 2018.

The benchmarks were part of the finding rather than the backdrop to it. “We find that these datasets are overwhelmingly composed of lighter-skinned subjects (79.6% for IJB-A and 86.2% for Adience) and introduce a new facial analysis dataset which is balanced by gender and skin type,” the abstract states. A single accuracy figure computed over a sample composed like that reports the larger group. The smaller one disappears. The U.S. Government Accountability Office recorded the same pattern, describing gender-classification evaluations that found “lower performance… on black females than white men”.

Position

An accuracy figure describes the test sample as much as the model

Accuracy gives equal weight to each evaluated observation, and not to each class, person or site. So the figure moves when the sample mix moves, with the model unchanged. The arithmetic earlier in this lesson makes that concrete. Across the 38,455 hospitalizations Wong and colleagues examined, sepsis occurred in 7%. A predictor that always answers no sepsis is right about almost every hospitalization and detects none of the 2,552 cases. Its balanced accuracy is 50%. One model, two numbers, and only one of them reaches the summary.

The same effect has been measured in a device that had already been cleared for use. Occult hypoxemia is arterial saturation under 88% despite a pulse-oximeter reading of 92–96%. It appeared in 11.7% of measurements from Black patients against 3.6% from White patients at Michigan, and in 17.0% against 6.2% in a 178-hospital cohort. “Thus, in two large cohorts, Black patients had nearly three times the frequency of occult hypoxemia that was not detected by pulse oximetry as White patients,” Sjoding and colleagues wrote in the New England Journal of Medicine in December 2020. The devices had been cleared against a single aggregate accuracy specification, and on the aggregate sample that specification held. The FDA's draft guidance of 6 January 2025 concedes the difference and proposes testing across the range of skin pigmentation.

The gender classifiers show the same thing on products that were already being sold. Darker-skinned females were the most misclassified group, with error rates of up to 34.7%, while the maximum error rate for lighter-skinned males was 0.8%. The two benchmarks audited were themselves 79.6% and 86.2% lighter-skinned. An aggregate computed over a sample composed like that is mostly a measurement of the majority inside it. A bare accuracy figure is not a property of a model. The composition of the sample it was computed on belongs in the same sentence as the number.

Change the mix of the test set and the accuracy changes; the model does not.

Steps

Select an averaging policy deliberately

Write the weighting question in plain language, then answer it in five moves. Name the atomic event: decide whether one row, one label decision, one class or one user receives equal weight. Inspect prevalence, measuring both the support in the test sample and the expected deployment mix — the 7% sepsis rate at Michigan Medicine and the emergency-department rate are different problems for the same model. Match the harm model, deciding whether rare classes or repeated entities deserve separate weight. Report the components: publish the per-class and per-slice values beside the aggregate, and say which averaging policy produced the aggregate, since clause 6.4.3 of ISO/IEC TS 4213:2022 gives macro, weighted and micro averaging three distinct names. Finally, stress the weights by recomputing under plausible future prevalence or policy priorities.

FigureProcess · 5 steps
  1. 1. Name the atomic event

    Decide whether one row, label decision, class, or user receives equal weight.

  2. 2. Inspect prevalence

    Measure support and expected deployment mix.

  3. 3. Match the harm model

    Decide whether rare classes or repeated entities deserve separate weight.

  4. 4. Report components

    Publish per-class or per-slice values beside the aggregate.

  5. 5. Stress the weights

    Recompute under plausible future prevalence or policy priorities.

Key takeaways