简体   繁体   English

如何使用libsvm获取概率输出

[英]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. 我想在LIBSVM中使用-b选项,但在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. 当我从参数中删除“ -b 1”时,在svmpredict中,我只会得到0或1的结果。 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! 您正在调用的svmtrain函数不是libsvm-它是Matlab的统计工具箱svmtrain.m!

Use which svmtrain to see which file is actually called. 使用which svmtrain查看实际调用的文件。 Make sure that you used libsvm's make to compile the necessary libsvm mex files and that they are in Matlab's path. 确保使用libsvm的make来编译必要的libsvm mex文件,并且它们在Matlab的路径中。 In my installation, I renamed libsvm's svmtrain and svmpredict mex files to libsvm_svmtrain and libsvm_svmpredict in order to avoid this ambiguity. 在我的安装中,我将libsvm的svmtrain和svmpredict mex文件重命名为libsvm_svmtrain和libsvm_svmpredict以避免这种歧义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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