How to do multi class classification using Support Vector Machines (SVM)

Solution 1:

LibSVM uses the one-against-one approach for multi-class learning problems. From the FAQ:

Q: What method does libsvm use for multi-class SVM ? Why don't you use the "1-against-the rest" method ?

It is one-against-one. We chose it after doing the following comparison: C.-W. Hsu and C.-J. Lin. A comparison of methods for multi-class support vector machines, IEEE Transactions on Neural Networks, 13(2002), 415-425.

"1-against-the rest" is a good method whose performance is comparable to "1-against-1." We do the latter simply because its training time is shorter.

Solution 2:

Commonly used methods are One vs. Rest and One vs. One. In the first method you get n classifiers and the resulting class will have the highest score. In the second method the resulting class is obtained by majority votes of all classifiers.

AFAIR, libsvm supports both strategies of multiclass classification.

Solution 3:

You can always reduce a multi-class classification problem to a binary problem by choosing random partititions of the set of classes, recursively. This is not necessarily any less effective or efficient than learning all at once, since the sub-learning problems require less examples since the partitioning problem is smaller. (It may require at most a constant order time more, e.g. twice as long). It may also lead to more accurate learning.

I'm not necessarily recommending this, but it is one answer to your question, and is a general technique that can be applied to any binary learning algorithm.