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

2 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Anshika Chaurasia
Anshika Chaurasia el 12 de Nov. de 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

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by