fitsvm in MATLAB 2014 and svmtrain in previous version

来源:互联网 发布:javascript显示和隐藏 编辑:程序博客网 时间:2024/05/17 07:25

matlab 2014以前的版本不包含fitcsvm()训练函数,而是以svmtrain()函数代替。网上找到的关于此函数的资料

原文:http://blog.163.com/liu_xi_en/blog/static/2817450620102297336227/


最近结合ACO和SVM做分类,于是仔细看了下svmtrain的help文档。现结合该doc文档,做简单整理,希望对

svm入门者有点帮助哦。

         svmtrain:用于训练支持向量机分类器。语法格式如下:

SVMStruct = svmtrain(TrainingGroup)

SVMStruct = svmtrain(..., 'Kernel_Function', Kernel_FunctionValue, ...)

SVMStruct = svmtrain(..., 'RBF_Sigma', RBFSigmaValue, ...)

SVMStruct = svmtrain(..., 'Polyorder', PolyorderValue, ...)

SVMStruct = svmtrain(..., 'Mlp_Params', Mlp_ParamsValue, ...)

SVMStruct = svmtrain(..., 'Method', MethodValue, ...)

SVMStruct = svmtrain(..., 'QuadProg_Opts', QuadProg_OptsValue, ...)

SVMStruct = svmtrain(..., 'SMO_Opts', SMO_OptsValue, ...)

SVMStruct = svmtrain(..., 'BoxConstraint', BoxConstraintValue, ...)

SVMStruct = svmtrain(..., 'Autoscale', AutoscaleValue, ...)

SVMStruct = svmtrain(..., 'Showplot', ShowplotValue, ...)

解释如下:

 Training是一个M行N列的矩阵,M是样本数,N是特征维数。Group:是个列向量,表示样本对应的类别,用字符串表示(可以用数字或单个字符)。

classifier is returned in SVMStruct, a structure with the following fields. 'Kernel_Function', Kernel_FunctionValue,.......'Showplot',ShowplotValue这些在svmtrain中是可选项。他们在svmtrain中出现的顺序是无关紧要的。但必须成对出现,前面单引号里的是字符标记,后面给出的是对应的值。Kernel_FunctionValue 有如下些可选类别: 

  • linear — Default. Linear kernel or dot product.
  • quadratic — Quadratic kernel.
  • rbf — Gaussian Radial Basis Function kernel with a default scaling factor, sigma, of 1.
  • polynomial — Polynomial kernel with a default order of 3.
  • mlp — Multilayer Perceptron kernel with default scale and bias parameters of [1, -1].

 如可通过如下来设定核函数为Gaussian Radial Basis Function kernel :

SVMStruct = svmtrain(TrainingGroup, 'Kernel_Function', rbf);

0 0
原创粉丝点击