# SVM confusion matrix whose dimensions are more than two

While I am using SVM, I train it with a train data and then I try to predict a sample if its label is -1 or +1. However, I see some confusion matrice for SVM like below. Mine are 2x2 matrice but their dimesions are larger, e.g. 15x15. Do they have more than one SVM? How people do such things? It is easy to write one diagonal but how they decide other values? In the figure below, for 2, it is easy to write 38 but how they write 2?

BTW, I am new to these topics.

• I understand if there are 15 svm models. While we are evaluating a sample if its model is correctly classifies it then we increment the value, e.g. 38 for 2. And if it is correctly classified by another model (this is a false positive), e.g. 10's model, we increment the value, e.g. 2 for 2. However, what if there are more than one model which says it is a valid (+1) sample for that model? What would we do in this case? How can we sure which one is correct? – Ricardo Cristian Ramirez Mar 23 '13 at 21:50
• There are multi-class SVMs as well ( svmlight.joachims.org/svm_multiclass.html ). For that matter, from the name of the file, it seems they are using one vs all multiclass SVMs - stats.stackexchange.com/questions/21465/… – TenaliRaman Mar 24 '13 at 2:19
• Confusion tables belong to classification (used in the sense that the outcome is nominal or maybe ordinal), not to regression - I removed the "regression" tag. – cbeleites unhappy with SX Mar 24 '13 at 17:09

## 1 Answer

Based on only the context we can get from the URL name, they are most likely using 15 SVMs, each of which tries to classify one class "versus" the rest (one-vs-all). Thus you need 15, and thus 15x15 confusion matrix.

You make a good point - more than one of these might declare a new point as their own. What then? A simple way is to use the hyperplane that is output as the model for the SVM and compare the distance to the plane in all +1 class labelings and accept the class for which the distance from the point to the plane is the greatest (ie, was most confidently classified).

The off-trace (incorrect) labelings the classifier makes are still done in the same way, ie,

C_ij = count(we declared i, but was actually j)