# Confusion matrix - classes get confused with each other

I got an example from this book on page 318: Chemometrics for Pattern Recognition By Richard G. Brereton. The example explained that; classes A and B are more often mistaken for each other than they are for classes C and D,..., as they may be more closely related or even can be better viewed as one single group.

Given a confusion matrix and assign some values to each class. How do you know which classes get confused with each other the most? Also, what it means by closely related or eve can be better viewed as one single group? How are A and B closely related and viewed as one single group in this example? Based on the value in the confusion matrix?

Example:

Chemometrics for Pattern Recognition By Richard G. Brereton - Google Book

The confusion matrix as the name suggest helps to identify how many of the predicted classes are being confused with true classes. For instance, in this case, the rows indicate the predicted classes and the columns indicates the correct classes.

So if we consider the diagonal values, the predicted and the true class is the same. Hence, the diagonal values do not indicate any confusion. When we check the upper triangular part of this matrix, the value 11 in your example indicates that 11 examples have been predicted as A when the correct values are actually B. Also, looking at (2,1)(the first value of second row) the value is 10. This implies that 10 values predicted as B actually are A. This shows that A and B are confused.

When two classes are closely related, it becomes harder to predict. For instance, an example I come across in my work is this. When I want to classify customer reviews, Speed of App and Speed of delivery classes seem to get confused because they have almost similar keywords in many of their examples. Since they both refer to speed, they are closely related and this leads to the confusion

10/75 class A is mispredicted as B, 11/60 class B is mispredicted as A.

Contrast this to The misclassification seen in C & D:

9 / 70 class C is mispredicted as D

And only 3 / 90 class D is mispredicted as C. There is actually more cases of class D that is mispredicted as A than C. Hence we cannot argue that D is confused with class C.