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

2 views (last 30 days)
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.

Accepted Answer

Anshika Chaurasia
Anshika Chaurasia on 12 Nov 2020
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

More Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!