2

I would like to use -b option in LIBSVM and could not find an example usage in Matlab. When I try to write this:

svmtrain(bow, [1;0;0;0;0;0;0;0], '-b 1');

I get "Wrong number of arguments" error. When I remove '-b 1' from arguments, in the svmpredict I only get 0 or 1 in result. I want the probability result. How can I do that?

Thanks

1 Answers1

0

The svmtrain function you are calling is not libsvm - it's Matlab's statistics toolbox svmtrain.m!

Use which svmtrainto see which file is actually called. Make sure that you used libsvm's make to compile the necessary libsvm mex files and that they are in Matlab's path. In my installation, I renamed libsvm's svmtrain and svmpredict mex files to libsvm_svmtrain and libsvm_svmpredict in order to avoid this ambiguity.

Trisoloriansunscreen
  • 1,543
  • 1
  • 15
  • 27
  • I have dowloaded and put libsvm into my workspace directory. How can i compile those mex files in windows? is there any tutorial for that? – Igor Snipet Dec 30 '15 at 22:04
  • Look for make.m in the libsvm\Matlab folder. There's also a readme file there. – Trisoloriansunscreen Dec 30 '15 at 22:15
  • After I go into /libsvm-master/matlab directory, in matlab I called "make" command and all MEXs completed succesfully. However, still when I use shich svmtrain, it shows matlab statistics toolbox. how to change that? sorry for multiple problems – Igor Snipet Dec 30 '15 at 22:19
  • If the mex files are there, I guess that path isn't right. Make sure that libsvm-master/matlab directory itself is added to your path. http://stackoverflow.com/questions/15557908/how-to-run-libsvm-in-matlab – Trisoloriansunscreen Dec 30 '15 at 22:22
  • As you have done I have changed the name as libsvm_train etc.and it worked – Igor Snipet Dec 30 '15 at 22:31