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

1 次查看(过去 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