SVM train and Classification Errors

2 ビュー (過去 30 日間)
Krishna Ganesh
Krishna Ganesh 2019 年 4 月 22 日
回答済み: Furkan DEMIR 2020 年 12 月 10 日
Hello Everyone im getting this weird error while im using svm train and classificationSvm. Need some help fixing it as i am new to this
Code Block: load Trainset.mat
xdata = meas;
group = label;
svmStruct = fitcsvm(xdata,group,'HyperparameterOptimizationOptions', struct('showplot',true), 'KernelFunction','rbf','KernelScale',0.5);
species = ClassificationSVM(svmStruct,feat,'showplot',true);
if strcmpi(species,'MALIGNANT')
helpdlg(' Malignant Tumor ');
disp(' Malignant Tumor ');
else
helpdlg(' Benign Tumor ');
disp(' Benign Tumor ');
end
set(handles.edit18,'string', species);
and the errors are
Error using ClassificationSVM (line 249)
Use fitcsvm to train an SVM model.
Error in untitled2>pushbutton12_Callback (line 615)
species = ClassificationSVM(svmStruct,feat,'showplot',true);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in untitled2 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)untitled2('pushbutton12_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
Anybody has any idea in what im doing wrong? any help will be appreciated :)

回答 (2 件)

Alan Weiss
Alan Weiss 2019 年 4 月 23 日
Try removing the line
species = ClassificationSVM(svmStruct,feat,'showplot',true);
To learn how to use the resulting SVM, see the documentation for fitcsvm.
Alan Weiss
MATLAB mathematical toolbox documentation

Furkan DEMIR
Furkan DEMIR 2020 年 12 月 10 日
Hello.
load Trainset.mat has two file. one of these meas and label.
When I see meas files. I saw 20*13 matrix. what is the meaning. Why the file is 20*13 matrix

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by