Input data:
load fisheriris % Load data
data = meas(1:100,1:2);
group = species(1:100); % lable of classes
Fisher's iris data consists of measurements on the sepal length, sepal width, petal length, and petal width for 150 iris specimens. There are 50 specimens from each of three species.
Train network:
svmStruct = svmtrain(data,group,'showplot',true); % train network
Crossvalidation:
[train, test] = crossvalind('holdOut',group);
cp = classperf(group);
Test network:
classes= svmclassify(svmStruct,data(test,:),'showplot',false);
classperf(cp,classes,test);
CorrectRate=cp.CorrectRate;
ErrorRate=cp.ErrorRate;
Linear classification:
Non-linear classification using RBF kernel:
Non-linear classification using quadratic kernel: