Confusion matrix
From Wikipedia, the free encyclopedia
In the field of artificial intelligence, a confusion matrix is a visualization tool typically used in supervised learning (in unsupervised learning it is typically called a matching matrix). Each column of the matrix represents the instances in a predicted class, while each row represents the instances in an actual class. One benefit of a confusion matrix is that it is easy to see if the system is confusing two classes (i.e. commonly mislabelling one as an other).
When a data set is unbalanced(when the number of samples in different classes vary greatly) the error rate of a classifier is not representative of the true performance of the classifier. This can easily be understood by an example. If there are for example 990 samples from class 1 and only 10 samples from class 2, the classifier can easily be biased towards class 1. If the classifier classifies all the samples as class 1, the accuracy will be 99%. This is not a good indication of the classifiers true performance. The classifier had a 100% recognition rate for class 1 but a 0% recognition rate for class 2.
In the example confusion matrix below, of the 8 actual cats, the system predicted that three were dogs, and of the six dogs, it predicted that one was a rabbit and two were cats. We can see from the matrix that the system in question has trouble distinguishing between cats and dogs, but can make the distinction between rabbits and other types of animals pretty well.
Cat | Dog | Rabbit | |
---|---|---|---|
Cat | 5 | 3 | 0 |
Dog | 2 | 3 | 1 |
Rabbit | 0 | 2 | 11 |
[edit] External links
- Howard J. Hamilton, Confusion Matrix, University of Regina.