support vector machines in matlab
artificial-intelligence, classification, machine-learning, matlab, svm
Solution
MATLAB does not support multiclass SVM at the moment. You could use `svmtrain` (2-classes) to achieve this, but it would be much easier to use a standard SVM package.
I have used LIBSVM and can confirm that it's very easy to use.
%%# Your data
D = [
1 2 3 4 0
1 2 3 5 0
0 2 6 4 1
0 3 3 8 1
7 2 6 4 2
9 1 7 10 3];
%%# For clarity
Attributes = D(:,1:4);
Classes = D(:,5);
train = [1 3 5 6];
test = [2 4];
%%# Train
model = svmtrain(Classes(train),Attributes(train,:),'-s 0 -t 2');
%%# Test
[predict_label, accuracy, prob_estimates] = svmpredict(Classes(test), Attributes(test,:), model);
Problem
Could you give an example of classification of 4 classes using Support Vector Machines (SVM) in matlab something like: ``` atribute_1 atribute_2 atribute_3 atribute_4 class 1 2 3 4 0 1 2 3 5 0 0 2 6 4 1 0 3 3 8 1 7 2 6 4 2 9 1 7 10 3 ```