您的位置:首页 > 其它

libsvm svm_predict_probability函数的用法――>返回概率

2014-10-06 12:16 856 查看
svm_predict_probability函数 需要在train之前设置parameter参数 才能得到概率模型。当svm_parameter.probability=1,或者options中的-b参数设置为1时。struct svm_parameter
{
int svm_type;
int kernel_type;
int degree; /* for poly */
double gamma; /* for poly/rbf/sigmoid */
double coef0; /* for poly/sigmoid */

/* these are for training only */
double cache_size; /* in MB */
double eps; /* stopping criteria */
double C; /* for C_SVC, EPSILON_SVR, and NU_SVR */
int nr_weight; /* for C_SVC */
int *weight_label; /* for C_SVC */
double* weight; /* for C_SVC */
double nu; /* for NU_SVC, ONE_CLASS, and NU_SVR */
double p; /* for EPSILON_SVR */
int shrinking; /* use the shrinking heuristics */
int probability; /* do probability estimates */ 1 do,0 not
};
2)svm_predict_probability函数与svm_predict函数在接口上只有第三个参数prob_estimates不同,其余两个都相同,所以这里只说明第三个参数的作用。prob_estimates里实际上存放的就是估计出的概率,比如说m分类问题,那prob_estimates就是一个1*m列的矩阵,没列代表属于相对类别的概率。这个相对类别是与svm输出结构体中的Lable相对应的!3)返回值,返回的就是最大概率对应的类别标签。如果二分类问题那就是1或-1.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: