ITKeyword,专注技术干货聚合推荐

注册 | 登录

Matlab libsvm svmpredict accuracy verbose

分享于

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1073

【阿里云】双十一活动,全年抄底价,限时3天!(老用户也有),
入口地址https://www.aliyun.com/1111/home

推荐:LIBSVM在MATLAB中的使用

下载 libsvm库下载:http://www.csie.ntu.edu.tw/~cjlin/libsvm/ 数据集下载:http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/ 配置 设置path:File->

up vote 0 down vote favorite I have a question of an annoying fact. I'm using libsvm with matlab and I'am able to predict using: predicted_label = svmpredict(Ylabel, Xlabel, model);

but it happen that every time I make a predictions appears this: Accuracy = X% (y/n) (classification)

Which I find annoying because I am repeating this procedure a lot of times and also makes it slow because its displaying in screen. I think what I want is to avoid that svmpredict being verbose. Can anyone help me with this? Thanks in advance. -Jessica matlab libsvm verbose
  |
  this question asked Aug 21 '13 at 7:07 jessica 132 3 17



 |  3 Answers

up vote 2 down vote ---Accepted---Accepted---Accepted---

If you are using matlab, just find the line of code that is displaying this information (usually using 'disp', 'sprintf', or 'fprintf') and comment it out using the commenting operator %. example: disp(['Accuracy= ' num2str(x)]);

change it to: % disp(['Accuracy= ' num2str(x)]);

If you are using the main libsvm library then you need to modify it before making. 1- Open the file 'svmpredict.c' 2- find this line of code: info("Accuracy = %g%% (%d/%d) (classification)\n",

(double)correct/total*100,correct,total);

3- just comment it out using // operator 4- save and close the file 5- make the project
  |
  this answer edited Aug 21 '13 at 8:10 answered Aug 21 '13 at 7:43 NKN 5,368 5 25 43 In addition to these suggestions, you may take a look at stackoverflow.com/questions/3029636/… –  Marc Claesen Aug 21 '13 at 8:46



 |  up vote 7 down vote I found a much better approach than editing the source code of the c library was to use matlabs evalc which places any output to the first output argument. [~ predicted_label] = evalc('svmpredict(Ylabel, Xlabel, model)');

Because the string to be evaluated is fixed should be no performance

推荐:在linux 配置matlab的 libsvm

libsvm作为一个svm的拓展,可以处理多分类问题。 参考: libsvm 库下载位置:http://www.csie.ntu.edu.tw/~cjlin/libsvm/ 根据libsvm-3.20/matlab 下的readme 1.

decrease.
  |
  this answer answered Aug 21 '13 at 10:06 Philliproso 641 1 4 14 I found this the easiest and most straight-forward solution –  user2208604 Mar 25 '15 at 21:06 Unfortunately this seems to be the only way to achieve this (without recompiling the source). –  zelanix May 22 '15 at 16:08

 |  up vote 6 down vote svmpredict(Ylabel, Xlabel, model, '-q');

From the manual: Usage: [predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model, 'libsvm_options')

[predicted_label] = svmpredict(testing_label_vector, testing_instance_matrix, model, 'libsvm_options')

Parameters:

model: SVM model structure from svmtrain.

libsvm_options:

-b probability_estimates: whether to predict probability estimates, 0 or 1 (default 0); one-class SVM not supported yet

-q : quiet mode (no outputs)


  |
  this answer answered Nov 18 '13 at 21:49 isakkarlsson 912 8 12 This is actually the best way to do it, doesn't involve recompiling things.. –  powder Apr 16 '14 at 12:18 1 Unfortunately quiet mode still has some outputs. Not no outputs. If you are doing grid based hyper-parameter searches your command line can still get flooded. –  Philliproso Mar 26 '15 at 8:09 Not really an answer to the question because this still outputs the Accuracy = ... message that the OP was trying to hide. –  zelanix May 22 '15 at 16:07



 | 

推荐:libsvm与matlab,安装调试

趁着所里的网好,我赶紧写下这么一篇bug调试,是关于matlab与 libsvm-mat-2.89-3[FarutoUltimate3.0Mcode] 的(一下简称libsvm)。 闲话不多说了,首先介绍一下博

up vote 0 down vote favorite I have a question of an annoying fact. I'm using libsvm with matlab and I'am able to predict using: predicted_label = svmpredict(Ylabel, Xlabel, model)

相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。