Overview

More than often, we want to evaluate the performance of a classifier. This can be summarised by using a table knowm as contingency table or confusion matrix

Confusion matrix

A confusion matrix is a table where each row refers to actual classes as recorder in the test set, and each column to classes as predicted by the classifier. When we have the confusion matrix computed, we can extract various perormance metrics. We will illustrate this with an example concerning two-class classification. Most, however not all, of the metrics can easilly be extended to more than two classes classification. The following table summarizes various metrics

Accuracy

Accuracy is perhaps the simplest of the metrics we can compute [2]. It is defined s the proportion of correctly classified instances:

$$\text{Accuracy} = \frac{\text{Number of correctly classified examples}}{\text{Total number of examples}}$$

Similarly, we can define the error rate as the proportion of incorrectly classified insrances. Clearly, this will be given by:

$$\text{Error rate} = 1 - \text{accuracy}$$

Conceptually, we can view accuracy as an estimate of the probability that an arbitrary instance $\mathbf{x}\in \mathbf{X}$ is classified correctly i.e. as the probability [2]

$$P(\hat{c}(\mathbf{x}) = c(\mathbf{x})| \hat{f})$$

References

  1. Confusion matrix
  2. Peter Flach, Machine Learning The Art and Science of Algorithms that Make Sense of Data, Cambridge Press