outputtest = multisvm(S​VMinput,SV​Mclass,SVM​testinput)​; % print out the output after SVM training

조회 수: 2 (최근 30일)
Dear community,
Below I attach two documents (.mat and .m) that I would like to use SVM to clasiffy the PD in power equipment.
I had change the svmtrain to fitcsvm(), and svmclassify to predict(). But there are still errors shown in the command window.
%%
Error using classreg.learning.internal.DisallowVectorOps/subsasgn (line 29)
You cannot assign to an object of class double using () indexing.
Error in multisvm (line 20)
models(k) = fitcsvm(TrainingSet,G1vAll);
Error in SwitchgearSVM_ANNonly1 (line 23)
outputtest = multisvm(SVMinput,SVMclass,SVMtestinput); % print out the output after SVM training
%%
Wish to get help from the community.
Thank you in advance.

채택된 답변

Anshika Chaurasia
Anshika Chaurasia 2020년 11월 12일
Hi Lee,
Try to replace models(k) with models{k} within multisvm function in SwitchgearSVM_ANNonly1.m.
I have attached the snippet of that part of code for your reference.
for k=1:numClasses
%Vectorized statement that binarizes Group
%where 1 is the current class and 0 is all other classes
G1vAll=(GroupTrain==u(k));
models{k} = fitcsvm(TrainingSet,G1vAll); % replace here models(k) with models{k}
end
%classify test cases
for j=1:size(TestSet,1)
for k=1:numClasses
if(predict(models{k},TestSet(j,:))) % replace here models(k) with models{k}
break;
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by