Matlab中libsvm函数使用说明

之前的版本的libsvm中对数据的预测可能只需要三输入两输出,而现在在libsvm3.2以上的需要变为四输入三输出,即传入predicted_label, accuracy, decision_values三个参数;

使用说明如下:

model = [train_Y, train_X,'libsvm_options']
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)

Returns:
  predicted_label: SVM prediction output vector.
  accuracy: a vector with accuracy, mean squared error, squared correlation coefficient.
  prob_estimates: If selected, probability estimate vector.

补充说明:accuracy中包含三个数据,第一个是准确率(精度);第二个是mse;第三个是平方相关系数;第二与第三是在回归问题中使用。

其中 options 为一些参数选项,主要有:
- s svm 类型:SW 模型设置类型(默认值为 o)
0:C-SVC(C-Support Vector Classification)
1;nu-SVC(nu~ Support Vector Classification)
2:one- class SVM
3:epsilon-SVR(epsilon- Support Vector Regression)
4:nu- SVR(nu - Support Vector Regression)

-t 核函数类型:核函数设置类型(默认值为 2)
0:线性核函数u’v
1:多项式核函数(T*u’v + coefO)degree
2:RBR 核函数 exp(~r│u-v│^2)
3.sigmoid 核函數 tanh(r *v’v ’ coefo)
-d degree.核兩数中的 degree 参数设置(针对多项式核函数,默认值为 3)

  • -g r(gama):核函数中的 gamma 参数函数设置(针对多项式/rbf/sigmoid 核函数,默认值为属性数目
    的倒数,即若k 为属性的数目,则~a参数默认为 1/k)
    – r coef0:核函数中的 coef0 参数设置(针对多项式/sigmoid 核函数,歌认值为 0)
    – c cost:设置 C- SVC. epsilon- SVR 和 nu- SVR 的参(默认值为 1)
    – n mu:设置 nu - SVC,one - class SVN 和 mu- SVR 的参数(默认值为 0.5)
    – p epsilon:设置 epsilon - SVR 中损失函数的值(默认值为 0.1)
    – m cachesize:设置 cache 内存大小,以 MB 为单位(默认值为 100)
    –e eps:设置允许的终止阈值(默认值为 0.001)
    – h shrinking:是否使用启发式,0 或 1(默认值为 1)
    –wi weight:设置第几类的参数 C 为 weight * C(对于 C- SVC中的 C,默认值为 1)
    –v n: n- fold 交互检验模式,n为折数,必须大于等于 2
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值