SVM学习笔记(2 )libsvm--svmtrain\svmpredict函数说明
2014-03-26 15:53
1151 查看
svmtrain(… );
%通过训练集来训练模型
svmpredict( … );
%对测试集进行预测
>>model = svmtrain(train_label,train_matrix, ['libsvm_options']);
-train_label:
An m by 1 vector of training labels (type must be double).
-train_matrix:
An m by n matrix of m training instances with n features.
It can be dense or sparse (type must be double).
-libsvm_options:
A string of training options in the same format as that ofLIBSVM.
===============
The 'svmtrain' functionreturns a model which can be used for future prediction.
>> [predicted_label,accuracy, decision_values/prob_estimates] = svmpredict(test_label, test_matrix,model, ['libsvm_options']);
-test_label:
An m by 1 vector of prediction labels. If labels of test dataare unknown, simply use any random values. (type must be double)
-testmatrix:
An m by n matrix of m testing instances with n features. It can be dense or sparse. (type must be double)
-model:
The output of svmtrain.
-libsvm_options:
A string of testing options in the same format as that ofLIBSVM.
===============
English:
libsvm_options:
-s svm_type : set type of SVM(default 0)
0 -- C-SVC
1 -- nu-SVC
2 -- one-class SVM
3 -- epsilon-SVR
4 -- nu-SVR
-t kernel_type : set type ofkernel function (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)
4 -- precomputed kernel (kernel values in training_instance_matrix)
-d degree : set degree inkernel function (default 3)
-g gamma : set gamma in kernelfunction (default 1/k)
-r coef0 : set coef0 in kernelfunction (default 0)
-c cost : set the parameter Cof C-SVC, epsilon-SVR, and nu-SVR (default 1)
-n nu : set the parameter nuof nu-SVC, one-class SVM, and nu-SVR (default 0.5)
-p epsilon : set the epsilonin loss function of epsilon-SVR (default 0.1)
-m cachesize : set cachememory size in MB (default 100)
-e epsilon : set tolerance oftermination criterion (default 0.001)
-h shrinking: whether to usethe shrinking heuristics, 0 or 1 (default 1)
-b probability_estimates:whether to train a SVC or SVR model for probability estimates, 0 or 1 (default0)
-wi weight: set the parameterC of class i to weight*C, for C-SVC (default 1)
-v n: n-fold cross validationmode
==========================================================
Chinese:
Options:可用的选项即表示的涵义如下
-s svm类型:SVM设置类型(默认0)
0 -- C-SVC
1 --nu-SVC
2 – 一类SVM
3 -- e -SVR
4 -- nu-SVR
-t 核函数类型:核函数设置类型(默认2)
0 – 线性:u'v
1 – 多项式:(r*u'v + coef0)^degree
2 – RBF函数:exp(-r|u-v|^2)
3 –sigmoid:tanh(r*u'v + coef0)
-d degree:核函数中的degree设置(针对多项式核函数)(默认3)
-g r(gama):核函数中的gamma函数设置(针对多项式/rbf/sigmoid核函数)(默认1/ k)
-r coef0:核函数中的coef0设置(针对多项式/sigmoid核函数)((默认0)
-c cost:设置C-SVC,e -SVR和v-SVR的参数(损失函数)(默认1)
-n nu:设置nu-SVC,一类SVM和nu- SVR的参数(默认0.5)
-p p:设置e -SVR 中损失函数p的值(默认0.1)
-m cachesize:设置cache内存大小,以MB为单位(默认40)
-e eps:设置允许的终止判据(默认0.001)
-h shrinking:是否使用启发式,0或1(默认1)
-wi weight:设置第几类的参数C为weight?C(C-SVC中的C)(默认1)
-v n: n-fold交互检验模式,n为fold的个数,必须大于等于2
其中-g选项中的k是指输入数据中的属性数。option -v 随机地将数据剖分为n部分并计算交互检验准确度和均方根误差。以上这些参数设置可以按照SVM的类型和核函数所支持的参数进行任意组合,如果设置的参数在函数或SVM类型中没有也不会产生影响,程序不会接受该参数;如果应有的参数设置不正确,参数将采用默认值。
%通过训练集来训练模型
svmpredict( … );
%对测试集进行预测
>>model = svmtrain(train_label,train_matrix, ['libsvm_options']);
-train_label:
An m by 1 vector of training labels (type must be double).
-train_matrix:
An m by n matrix of m training instances with n features.
It can be dense or sparse (type must be double).
-libsvm_options:
A string of training options in the same format as that ofLIBSVM.
===============
The 'svmtrain' functionreturns a model which can be used for future prediction.
>> [predicted_label,accuracy, decision_values/prob_estimates] = svmpredict(test_label, test_matrix,model, ['libsvm_options']);
-test_label:
An m by 1 vector of prediction labels. If labels of test dataare unknown, simply use any random values. (type must be double)
-testmatrix:
An m by n matrix of m testing instances with n features. It can be dense or sparse. (type must be double)
-model:
The output of svmtrain.
-libsvm_options:
A string of testing options in the same format as that ofLIBSVM.
===============
English:
libsvm_options:
-s svm_type : set type of SVM(default 0)
0 -- C-SVC
1 -- nu-SVC
2 -- one-class SVM
3 -- epsilon-SVR
4 -- nu-SVR
-t kernel_type : set type ofkernel function (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)
4 -- precomputed kernel (kernel values in training_instance_matrix)
-d degree : set degree inkernel function (default 3)
-g gamma : set gamma in kernelfunction (default 1/k)
-r coef0 : set coef0 in kernelfunction (default 0)
-c cost : set the parameter Cof C-SVC, epsilon-SVR, and nu-SVR (default 1)
-n nu : set the parameter nuof nu-SVC, one-class SVM, and nu-SVR (default 0.5)
-p epsilon : set the epsilonin loss function of epsilon-SVR (default 0.1)
-m cachesize : set cachememory size in MB (default 100)
-e epsilon : set tolerance oftermination criterion (default 0.001)
-h shrinking: whether to usethe shrinking heuristics, 0 or 1 (default 1)
-b probability_estimates:whether to train a SVC or SVR model for probability estimates, 0 or 1 (default0)
-wi weight: set the parameterC of class i to weight*C, for C-SVC (default 1)
-v n: n-fold cross validationmode
==========================================================
Chinese:
Options:可用的选项即表示的涵义如下
-s svm类型:SVM设置类型(默认0)
0 -- C-SVC
1 --nu-SVC
2 – 一类SVM
3 -- e -SVR
4 -- nu-SVR
-t 核函数类型:核函数设置类型(默认2)
0 – 线性:u'v
1 – 多项式:(r*u'v + coef0)^degree
2 – RBF函数:exp(-r|u-v|^2)
3 –sigmoid:tanh(r*u'v + coef0)
-d degree:核函数中的degree设置(针对多项式核函数)(默认3)
-g r(gama):核函数中的gamma函数设置(针对多项式/rbf/sigmoid核函数)(默认1/ k)
-r coef0:核函数中的coef0设置(针对多项式/sigmoid核函数)((默认0)
-c cost:设置C-SVC,e -SVR和v-SVR的参数(损失函数)(默认1)
-n nu:设置nu-SVC,一类SVM和nu- SVR的参数(默认0.5)
-p p:设置e -SVR 中损失函数p的值(默认0.1)
-m cachesize:设置cache内存大小,以MB为单位(默认40)
-e eps:设置允许的终止判据(默认0.001)
-h shrinking:是否使用启发式,0或1(默认1)
-wi weight:设置第几类的参数C为weight?C(C-SVC中的C)(默认1)
-v n: n-fold交互检验模式,n为fold的个数,必须大于等于2
其中-g选项中的k是指输入数据中的属性数。option -v 随机地将数据剖分为n部分并计算交互检验准确度和均方根误差。以上这些参数设置可以按照SVM的类型和核函数所支持的参数进行任意组合,如果设置的参数在函数或SVM类型中没有也不会产生影响,程序不会接受该参数;如果应有的参数设置不正确,参数将采用默认值。
相关文章推荐
- libsvm,svmtrain函数参数说明
- SVM学习笔记(一):libsvm参数说明(转)
- svm理论与实验之13: libsvm库函数说明
- SVM学习笔记4-核函数和离群点的处理
- Python学习笔记之常用函数及说明
- php中__get()和__set()函数学习笔记和实例说明!
- 低功耗蓝牙cc2541学习笔记之UART-1-协议栈函数功能说明
- 【MFC学习笔记3】ASSERT()函数用法,CFileFind Class 说明。
- libsvm代码阅读:关于svm_train函数分析
- Python学习笔记之常用函数及说明
- Python学习笔记:split()函数和strip()函数的使用说明
- 【OpenCV学习笔记】【函数学习】十四(cvSeq的用法说明(功能很多,按照需求使用))
- SVM学习笔记(1)LIBSVM在matlab下的使用安装
- SVM学习笔记(1 )LIBSVM中的核函数及其参数
- matlab中svmtrain函数和LibSVM中svmtrain函数冲突的问题的解决方案
- 韩顺平 javascript教学视频_学习笔记16_Object类_闭包_成员函数再说明_聪明的猪小练习
- SVM学习笔记(2)LIBSVM在python下的使用
- 韩顺平_轻松搞定网页设计(html+css+javascript)_第33讲_Object类_闭包_成员函数再说明_聪明的猪小练习_学习笔记_源代码图解_PPT文档整理
- ThinkPHP 学习笔记<一>:ThinkPHP常用函数说明
- 【OpenCV学习笔记】【函数学习】十(常用的OpenCV函数汇总说明)