模型不支持libsvm中的概率估计 [英] Model does not support probabiliy estimates in libsvm

查看:301
本文介绍了模型不支持libsvm中的概率估计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在训练和预测过程中,我在Matlab中将libsvm与选项'-b 1'一起使用.但是它总是返回Model does not support probabiliy estimates,所以我没有得到任何概率或准确性估计.我在二进制类SVM(不是nu-svm!)中尝试过,它应该与'-b 1'一起工作,但事实并非如此.有谁知道这个问题的原因是什么?

I used libsvm in Matlab with the option '-b 1' in both training and prediction process. But it always returns Model does not support probabiliy estimates, so I don't get any probability or accuracy estimation. I tried in binary class SVM (not nu-svm!), it should have work with the '-b 1' but it's not. Does anyone know what's the reason for this problem?

谢谢

推荐答案

  1. 让我告诉您 svm-predict 的用法:
  1. Let me show you the usage of svm-predict:

用法:svm-predict [选项] test_file model_file output_file 选项:

Usage: svm-predict [options] test_file model_file output_file options:

-b potential_estimates:是预测概率估计值,是0还是1(默认值为0);对于一类SVM,仅支持0

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

-q:安静模式(无输出)

-q : quiet mode (no outputs)

  1. svm-train:

用法:svm-train [选项] training_set_file [model_file]选项:

Usage: svm-train [options] training_set_file [model_file] options:

-s svm_type : set type of SVM (default 0)

0-C-SVC(多类别分类)

0 -- C-SVC (multi-class classification)

1-nu-SVC(多类别分类)

1 -- nu-SVC (multi-class classification)

2-一类SVM

3-epsilon-SVR(回归)4-nu-SVR(回归)

3 -- epsilon-SVR (regression) 4 -- nu-SVR (regression)

-t kernel_type:设置内核函数的类型(默认为2)
0-线性:u' v 1-多项式:(gamma u' v + coef0)^ degree
2-径向基函数:exp(-gamma
| u-v | ^ 2)
3-乙状结肠:tanh(gamma * u'* v + coef0)

-t kernel_type : set type of kernel function (default 2)
0 -- linear: u'v 1 -- polynomial: (gammau'v + coef0)^degree
2 -- radial basis function: exp(-gamma
|u-v|^2)
3 -- sigmoid: tanh(gamma*u'*v + coef0)

4-预先计算的内核(training_set_file中的内核值)

4 -- precomputed kernel (kernel values in training_set_file)

-d度:设置内核函数的度(默认为3)

-d degree : set degree in kernel function (default 3)

-g gamma:在内核函数中设置gamma(默认值为1/num_features)

-g gamma : set gamma in kernel function (default 1/num_features)

-r coef0:在内核函数中设置coef0(默认为0)

-r coef0 : set coef0 in kernel function (default 0)

-c cost:设置C-SVC,epsilon-SVR和nu-SVR的参数C(默认为1)

-c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)

-n nu:设置nu-SVC,一类SVM和nu-SVR的参数nu(默认值为0.5)

-n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)

-p epsilon:在epsilon-SVR的损失功能中设置epsilon(默认值为0.1)

-p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)

-m cachesize:以MB为单位设置缓存内存大小(默认为100)

-m cachesize : set cache memory size in MB (default 100)

-e epsilon:设置终止标准的容差(默认为0.001)

-e epsilon : set tolerance of termination criterion (default 0.001)

-h收缩:是使用0还是1(默认为1)的收缩试探法

-h shrinking : whether to use the shrinking heuristics, 0 or 1 (default 1)

-b density_estimates:是否为概率估计训练SVC或SVR模型,即0还是1(默认为0)

-wi weight:对于C-SVC(默认值为1),将类i的参数C设置为weight * C.

-wi weight : set the parameter C of class i to weight*C, for C-SVC (default 1)

-v n:n折交叉验证模式

-v n: n-fold cross validation mode

-q:安静模式(无输出)

-q : quiet mode (no outputs)

我们可以看到最后第四行是-b选项.如果我们使用"-b 1"选项训练模型,那么您将获得一个可以在您尝试进行预测时输出概率的模型.否则,如果您仅在尝试预测而不使用'-b 1'生成模型时使用'-b 1'选项.您会得到错误:模型不支持概率估计

We can see that the last fourth line is -b option. If we trained the model with '-b 1' option, we'll get a model that can output probability when you try to predict. Otherwise, if you only use '-b 1' option when you try to predict and not generate a model with '-b 1'. you will get the error : Model does not support probabiliy estimates

最主要的是,如果要获取概率估计值,则应在火车中使用" -b 1 "并进行测试过程,它们两个.

The main thing is that if you want to get probabiliy estimates, you should use '-b 1' in your train and test process, both of them.

这篇关于模型不支持libsvm中的概率估计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆