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 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by