libsvm使用总结

./tools/

subset.py  分割数据集

grid.py   优化参数c、g

checkdata.py   检测数据集格式

easy.py   综合

./windows/

svm-scale.exe  规范化

svm-train.exe 训练模型

svm-pridict.exe  预测分类

检测数据格式 python checkdata.py train.txt
优化数据 svm-scale filename
训练模型 svm-train.exe heart_scale
预测测试集 svm-predict heart_scale heart_scale.model heart_scale.out
进行参数最优估计 python grid.py heart_scale
利用已得参数重新训练模型 svm-train.exe -c 2048 -g 0.0001220703125 heart_scale
重新预测 svm-predict.exe test.txt heart_scale.model output.predict

一步到位的命令   python easy.py heart_scale heart_test

参数介绍

-c:参数

-g: 参数

-v:交叉验证数

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

0 -- C-SVC支持向量分类机;参数C为惩罚系数,C越大表示对错误分类的惩罚越大,适当的参数C对分类Accuracy很关键。

1 -- nu-SVC v-支持向量分类机;由于C的选取比较困难,用另一个参数v代替C。C是“无意义”的,v是有意义的。(与C_SVC其实采用的模型相同,但是它们的参数C的范围不同,C_SVC采用的是0到正无穷,该类型是[0,1]。)

2 -- one-class SVM  非监督。。 支持向量回归机,由于EPSILON_SVR需要事先确定参数,然而在某些情况下选择合适的参数却不是一件容易的事情。而NU_SVR能够自动计算参数。

3 -- epsilon-SVR  支持向量回归机,不敏感损失函数,对样本点来说,存在着一个不为目标函数提供任何损失值的区域。

4 -- nu-SVR  支持向量回归机,由于EPSILON_SVR需要事先确定参数,然而在某些情况下选择合适的参数却不是一件容易的事情。而NU_SVR能够自动计算参数。

-t kernel_type : set type of kernelfunction (default 2)

0 -- linear: u'*v

1 -- polynomial: (gamma*u'*v + coef0)^degree

2 -- radial basis function: exp(-gamma*|u-v|^2)

3 -- sigmoid: tanh(gamma*u'*v + coef0)  神经元的非线性作用函数核函数(Sigmoid tanh)

用户自定义核函数

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

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

50W训练参数选择

原文地址:https://www.cnblogs.com/anqiang1995/p/7819700.html