Multi Class SVM

Version (1.5 KB) by Cody
Model and classify training/test data sets into more than 2 classes with SVM.
Updated 7 Dec 2012

View License

Support Vector Machines only classify data into two classes. This function removes that restriction by "searching" for the correct class for each row in the test data set.

This code is a clarification and optimization of Anand Mishra's code found here:

Use only with more than 2 classes, otherwise use svmtrain() directly.

Usage Example:

%% SVM Multiclass Example
% SVM is inherently one vs one classification.
% This is an example of how to implement multiclassification using the
% one vs all approach.
TrainingSet=[ 1 10;2 20;3 30;4 40;5 50;6 66;3 30;4.1 42];
TestSet=[3 34; 1 14; 2.2 25; 6.2 63];
results = multisvm(TrainingSet, GroupTrain, TestSet);
disp('multi class problem');

Cite As

Cody (2024). Multi Class SVM (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Multi Class Support Vector Machine

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes