python 支持向量机 导出参数,抑制libsvm中的输出(python)

I am using libsvm (svmutils) from python for a classification task. The classifier is exact. However, I am getting output like this:

*

optimization finished, #iter = 75

nu = 0.000021

obj = -0.024330, rho = 0.563710

nSV = 26, nBSV = 0

Total nSV = 26

*

optimization finished, #iter = 66

nu = 0.000030

obj = -0.035536, rho = -0.500676

nSV = 21, nBSV = 0

Total nSV = 21

*

optimization finished, #iter = 78

nu = 0.000029

obj = -0.033921, rho = -0.543311

nSV = 23, nBSV = 0

Total nSV = 23

*

optimization finished, #iter = 90

nu = 0.000030

obj = -0.035333, rho = -0.634721

nSV = 23, nBSV = 0

Total nSV = 23

Accuracy = 0% (0/1) (classification)

Accuracy = 0% (0/1) (classification)

Accuracy = 0% (0/1) (classification)

Accuracy = 0% (0/1) (classification)

Is there any way I can suppress this dialog? The classifier serves perfectly fine, I am just curious. Also, what does the "Accuracy" stand for? And why this is 0% in my case? (The data is non-overlapping in 80 dimensions. Total 4 classes. I have also normalized it properly.)

解决方案

Use the -q parameter option

import svmutil

param = svmutil.svm_parameter('-q')

...

or

import svmutil

x = [[0.2, 0.1], [0.7, 0.6]]

y = [0, 1]

svmutil.svm_train(y, x, '-q')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值