# Plot confusion matrix using PCA

I am trying to represent graphically the results of a classifier with multiple groups. I am not so much interested in the accuracy of the classifier, as the degree to which the classifier confuses certain categories. So, for example, from a confusion matrix like the following:

  a  b  c
a 10 0  6
b 1  8  1
c 7  0  15


The plot show should that a and c are more similar than a and b or than b and c. What I am doing is applying PCA directly to the confusion matrix and then plotting the first and second components. Also creating a dendogram with -cor(m) as the distance. Both seem to produce the 'right' result but I am not sure this is justified. Also, nonmetric MDS seems to work very much like the PCA approach.

Are these approaches valid? are there better alternatives?

• that a and c are more similar than a and b or than b and c Do you mean to compare profiles of the 3 rows? If so why not of the 3 columns then? Aug 30 '16 at 17:46
• I mean that the model makes a lot more errors distinguishing a from c than distinguishing a from b or b from c (this has theoretical implications for what I'm doing). So ideally, I want to show this fact on an easy to read plot. With only three categories it is easy to read the confusion matrix, but with 10 it gets tricky for the reader. So, something like a two dimensional plot where the categories with more errors in common are plotted closer to each other, or a dendogram seem like intuitive solutions. Aug 30 '16 at 19:28
• You could maybe interpretate the confusion matrix as a kind of similarity matrix and present is graphically via multidimensional scaling Aug 30 '17 at 22:06