Accuracy from Class Counts

Accuracy divides the number of correct predictions by the number of evaluated predictions for a classification task.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a small matrix
  2. Check class balance
  3. Verify correct decisions as a share of all cases
  4. Compare with per-class and baseline evidence

Trace a small matrix

Six true positives and twelve true negatives among twenty examples yield \(18/20=0.9\). This combines the two correct entries from a confusion matrix.

Check class balance

A classifier predicting the majority class can have high accuracy when that class dominates. Report per-class evidence when rare outcomes matter. Majority baselines provide a useful comparison.[1][2]

Verify correct decisions as a share of all cases

With eight true positives, ninety true negatives, one false positive and one false negative, accuracy is \(98/100\). Both correct classes contribute. Class imbalance can make a large accuracy value coexist with poor performance on a rare class. See a majority-class baseline.

TP=8, TN=90, FP=1, FN=1
Correct: 98
Total: 100
Accuracy: .98

Compare with per-class and baseline evidence

Report the majority baseline, positive support and selected error types. Check whether evaluation data represent the choices the model will face after deployment.

References

  1. Gareth James et al., An Introduction to Statistical Learning ↩
  2. scikit-learn Developers, Metrics and Scoring: Quantifying the Quality of Predictions ↩