SVMs do not naturally generalize for multi-class. They can be extended to multi-class problems by using one-versus-one and one-versus-all approaches.

For purpose of demonstration, let us use the IRIS dataset.

Note: The purpose is to demonstrate the capability of SVM and not create the best model for the dataset.

One-Versus-One

In a multi-class problem, One-Versus-One approach builds K(K-1)/2 SVMs and the final classification is done on the basis of majority voting.

One-Versus-All

In a multi-class problem, One-Versus-All approach builds K SVMs each time comparing one of the classes with K-1 classes. The final classification is done on the basis of the widest margin, i.e., the value for which the below Equation (1) has the largest value.

Equation (1)

Cheers!

Happy Learning!

--

--

Anant Kumar

Machine Learning & Deep Learning Practitioner | Learning is Continuous | Github : https://github.com/anant-kumar-0308