简体   繁体   中英

How to use libsvm to get probability output

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

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

Use which svmtrain to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM