error using svmtrain (not enough inputs)
Mostrar comentarios más antiguos
i am using a code
clc
C=[1 2 3 ;4 5 6]
TrainLabel=C;TrainVec=[0;1];
bestcv = 0;
for log2c = -6:10,
for log2g = -6:3,
cmd = ['-v 5 -c ', num2str(2^log2c), ' -g ', num2str(2^log2g)];
cv = svmtrain(TrainLabel,TrainVec, cmd);
if (cv >= bestcv),
bestcv = cv; bestc = 2^log2c; bestg = 2^log2g;
end
fprintf('(best c=%g, g=%g, rate=%g)\n',bestc, bestg, bestcv);
end
end
i get error as
Error using ==> svmtrain at 225
Incorrect number of arguments to svmtrain.
Error in ==> ex2011 at 10
cv = svmtrain(TrainLabel,TrainVec, cmd);
please help were i have done mistake
Respuestas (3)
Ilya
el 5 de Abr. de 2012
0 votos
If you are using svmtrain function from the official MATLAB install (verify by typing 'which svmtrain' in your command window), it does not accept the syntax of your cmd string. Please read 'help svmtrain' or 'doc svmtrain'.
Walter Roberson
el 5 de Abr. de 2012
The Mathworks-provided svmtrain() does not accept an argument which is a single string with flags and values. Instead it accepts only name/value pairs, such as
svmtrain(TrainLabel,TrainVec, 'method', 'SMO')
The flags you use have no obvious correspondence in the supported name/value pairs.
3 comentarios
kash
el 6 de Abr. de 2012
kash
el 6 de Abr. de 2012
Walter Roberson
el 7 de Abr. de 2012
Editada: Walter Roberson
el 12 de Ag. de 2021
ansha nisar
el 12 de Ag. de 2021
0 votos
How can I resolve this problem Error using svmtrain
1 comentario
Walter Roberson
el 12 de Ag. de 2021
models{k} = fitcsvm(Trainfea, G1vAll, 'solver', 'SMO');
and later
if predict(models{k}, Testfea(j,:))
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!