finding classifier performance in MATLAB

1 view (last 30 days)
Ramya Mohan
Ramya Mohan on 4 Feb 2013
Edited: Walter Roberson on 14 Nov 2016
I want to classify the breast cancer dataset using SVM.
I divide the 569 instances into 5 sets of data and groups, then use classperf function to compute the performance, but I don't know what arguments are to be given in classperf function. Pls help me.
============================================================
clc;clf;clear all;close all;
data=xlsread('DATACANCER.XLSX');
load clasy;
i=24;
j=25;
data = [data(:,i), data(:,j)];
A1= data(1:113,:);A2=data(114:226,:);A3=data(227:340,:);A4=data(341:454,:);A5=data(455:569,:);
groups = ismember(species,'B');
[train, test] = crossvalind('holdOut',groups,0.2);
G1=groups(1:113,:);G2=groups(114:226,:);G3=groups(227:340,:);G4=groups(341:454,:);G5=groups(455:569,:);
cp = classperf(groups);
figure
svmStruct = svmtrain(A1,G1,'showplot',true);
title(sprintf('Kernel Function: %s',...
func2str(svmStruct.KernelFunction)),...
'interpreter','none');
classes = svmclassify(svmStruct,A2,'showplot',true);
classperf(cp,classes,----);<--------HERE IS MY DOUBT
ans1=cp.CorrectRate*100;
disp(ans1);
cp
figure
svmStruct = svmtrain(A2,G2,'showplot',true);
title(sprintf('Kernel Function: %s',...
func2str(svmStruct.KernelFunction)),...
'interpreter','none');
classes = svmclassify(svmStruct,A3,'showplot',true);
classperf(cp,classes,----);<--------HERE IS MY DOUBT
ans2=cp.CorrectRate*100;
disp(ans2);
cp
figure
svmStruct = svmtrain(A3,G3,'showplot',true);
title(sprintf('Kernel Function: %s',...
func2str(svmStruct.KernelFunction)),...
'interpreter','none');
classes = svmclassify(svmStruct,A4,'showplot',true);
classperf(cp,classes,--------);<--------HERE IS MY DOUBT
ans3=cp.CorrectRate*100;
disp(ans3);
cp
figure
svmStruct = svmtrain(A4,G4,'showplot',true);
title(sprintf('Kernel Function: %s',...
func2str(svmStruct.KernelFunction)),...
'interpreter','none');
classes = svmclassify(svmStruct,A5,'showplot',true);
classperf(cp,classes,-------);<--------HERE IS MY DOUBT
ans4=cp.CorrectRate*100;
disp(ans4);
cp
figure
svmStruct = svmtrain(A5,G5,'showplot',true);
title(sprintf('Kernel Function: %s',...
func2str(svmStruct.KernelFunction)),...
'interpreter','none');
classes = svmclassify(svmStruct,A1,'showplot',true);
classperf(cp,classes,-------);<--------HERE IS MY DOUBT
ans5=cp.CorrectRate*100;
disp(ans5);
cp

Answers (0)

Categories

Find more on Biotech and Pharmaceutical in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!