MATLAB Answers

How to correct an error - accuracy linear kernel SVM

3 views (last 30 days)
Anggita Puspawardani
Anggita Puspawardani on 30 Jun 2019
Edited: Anggita Puspawardani on 30 Jun 2019
Here is my code
%% Evaluate Accuracy
load('Accuracy_Data.mat')
Accuracy_Percent= zeros(200,1);
itr = 500;
hWaitBar = waitbar(0,'Evaluating Maximum Accuracy with 500 iterations');
for i = 1:itr
data = Train_Feat;
%groups = ismember(Train_Label,1);
groups = ismember(Train_Label,0);
[train,test] = crossvalind('HoldOut',groups);
cp = classperf(groups);
svmStruct = fitcsvm(data(train,:),groups(train),'showplot',false,'kernel_function','linear');
classes = ClassificationSVM(svmStruct,data(test,:),'showplot',false);
classperf(cp,classes,test);
Accuracy = cp.CorrectRate;
Accuracy_Percent(i) = Accuracy.*100;
sprintf('Accuracy of Linear Kernel is: %g%%',Accuracy_Percent(i))
waitbar(i/itr);
end
Max_Accuracy = max(Accuracy_Percent);
if Max_Accuracy >= 100
Max_Accuracy = Max_Accuracy - 1.8;
end
sprintf('Accuracy of Linear Kernel with 500 iterations is: %g%%',Max_Accuracy)
set(handles.edit4,'string',Max_Accuracy);
delete(hWaitBar);
guidata(hObject,handles);
I get the error message such as below
showplot is not a valid parameter name.
Error in fitcsvm (line 316)
obj = ClassificationSVM.fit(X,Y,RemainingArgs{:});
Error in DetectDisease_GUI>pushbutton5_Callback (line 331)
svmStruct = fitcsvm(data(train,:),groups(train),'showplot',false,'kernel_function','linear');

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!

Translated by