You are on page 1of 4

TRAIN GRAPH

TEST GRAPH

CLASSIFICATION PROGRAM

>> %Classification Program.

>>

>> %Load the data, which includes proximates analysis


data of 60 samples.

>> load project

>> data=[proximate(:,1),proximate(:,4)]; %Create data


two column matrix.
>> groups=ismember(label,'biomass'); %From the label
vector, groups, to classify data into two classes: Biomass
and Non-biomass.

>> [train,test]=crossvalind('holdOut',groups,0.5); %Split


train and test.

>> cp=classperf(groups); %Indicate performance of


classifier.

>>

>> %svmtrain function to train svm classifier using a RBF


Kernel and plot the grouped data.

>>
svmStruct=svmtrain(data(train,:),groups(train),'Kernel_Fu
nction','rbf','RBF_Sigma',0.5,'boxconstraint',0.03125,'show
plot',true);

>> title(sprintf('Kernel Function: %s',...

func2str(svmStruct.KernelFunction)),...

'interpreter','none');

>>
classes=svmclassify(svmStruct,data(test,:),'showplot',true
); %Classify the test set using SVM.

>> classperf(cp,classes,test); %Evaluate the performance


of classifier.
>> cp.correctRate

ans =

0.9000

You might also like