Accuracy (machine learning)

The number of correct classification predictions divided by the total number of predictions.1 That is:

Accuracy=correct preds+incorrect predscorrect preds\text{Accuracy} = \frac{\text{correct preds} + \text{incorrect preds}}{\text{correct preds}}

Binary classification provides specific names for the different categories of correct predictions and incorrect predictions. So, the accuracy formula for binary classification is as follows:1

Accuracy=TP+TNTP+TN+FT+FN\text{Accuracy} = \frac{TP + TN}{TP + TN + FT + FN}

where:

When to use

Because it incorporates all four outcomes from the confusion matrix (TP, FP, TN, FN), given a balanced dataset, with similar numbers of examples in both classes, accuracy can serve as a coarse-grained measure of model quality. For this reason, it is often the default evaluation metric used for generic or unspecified models carrying out generic or unspecified tasks.2

However, when the dataset is imbalanced, or where one kind of mistake (FN or FP) is more costly than the other, which is the case in most real-world applications, it’s better to optimize for one of the other metrics instead.2

See also

Footnotes

  1. developers.google.com/machine-learning/glossary#accuracy 2

  2. ML crash course - Classification 2

2024 © ak