Svm Using Matlab

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Svm Using Matlab as PDF for free.

More details

  • Words: 108
  • Pages: 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

Related Documents