Simple principle process transfer from: Http://wenku.baidu.com/link?url=57aywD0Q6WTnl7XKbIHuEwWENnSuPS32QO8X0a0gHpOOzdnNt_ K0mk2cucvaehvsajhvbcvqnzghe_tegwodevownbatyaa0bc5edzqweem
Detailed principles and experiments 1:PMTK Toolbox and experiment 2:libsvm Transferred from: Http://blog.163.com/[email protected]/blog/static/171861983201171410833824/
Matlab use: Http://wenku.baidu.com/link?url=LUhL9dE1zi2R5VQMIHCicN2bAxcCea_ F7wjrek73pkukfplkeyrx8holg45zgyygmkckh92fw1l-6lecvpjjzsbjdvspfme38frt8rtj-h7
The 1.matlab comes with svmtrain,svmclassify. Which Svmtrain understand: http://blog.sina.com.cn/s/blog_48e6733501016dhl.html
Svmtrain Understand: Training is a matrix of m rows n columns, M is the number of samples, and N is the feature dimension. Group: is a column vector that represents the category of the sample, expressed as a string (either with a number or a single character). Example: Svmstruct = Svmtrain (sd,y, ' kernel_function ', ' quadratic ', ' showplot ', true);
Among the Kernel_functionvalue are the following optional categories:
-
- 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].
- Fuction
The circle represents the support vector
Example of the Svmclassify function rd=svmclassify (svmstruct,sd, ' Showplot ', true);
Examples in 2.LIBSVM:
Model = Svmtrain (Allcoor_label, Allcoor, '-C 1-g 0.007-t 0 ');
[Ptrain_label, Train_accuracy] = Svmpredict (Allcoor_label, Allcoor, model);
The options have the following meanings:
-S SVM type: Sets the SVM type, the default value is 0, and the optional type is:
0--C-svc
1--Nu-svc
2--ONE-CLASS-SVM
3--E-svr
4--Nu-svr
-T kernel function type: Sets the kernel function type, the default value is 2, the optional type is:
0--Linear Core: U ' *v
1--Polynomial nucleus: (g*u ' *v+ coef0) degree
2--RBF Core: exp (-| | u-v| | *|| u-v| | /G*G)
3--sigmoid core: Tanh (g*u ' *v+ coef 0)
-D Degree: the degree setting in the kernel function, the default value is 3;
-G R (Gama): function setting in kernel function (default 1/k);
-R COEF 0: sets the COEF0 in the kernel function, the default value is 0;
-C Cost: Set C-svc, E-svr, n-svr from the penalty factor C, the default value is 1;
-N nu: Set nu-svc, ONE-CLASS-SVM and Nu-svr parameters nu, default value 0.5;
-P E: Kernel width, set e-svr in the loss function of E, the default value is 0.1;
-M CacheSize: Sets the cache memory size in megabytes (default 40):
-E: Sets the tolerable deviation in the termination criteria, the default value is 0.001;
-H Shrinking: Whether heuristic is used, optional value is 0 or 1, default value is 1;
-B probability estimate: whether to calculate the probability estimate of Svc or SVR, optional value 0 or 1, default 0;
-wi weight: The penalty coefficient C weighted for each kind of sample, the default value is 1;
-V N/A fold cross-validation mode.
attached : MATLAB with the SVM implementation function and LIBSVM difference between:
1 MATLABBring your ownSVMthe only model that implements the function isC-SVC (c-support vector classification); andLIBSVMToolbox hasC-SVC (C-support vector classification), nu-svc (nu-support vector classification), One-class SVM (distribution estimation), epsilon-svr (epsilon-support vector regression), nu-svr (nu-support vector regression)A variety of models are available for use.
2 MATLABBring your ownSVMthe implementation function only supports classification problems and does not support regression problems;LIBSVMnot only support the classification problem, but also support the regression problem.
3 MATLABBring your ownSVMimplementation function only supports two classification problem, multi-classification problem should be implemented according to the corresponding algorithm of multi-classification;LIBSVMAdopt1v1The algorithm supports multiple classifications.
4 MATLABBring your ownSVMImplement function AdoptionRBFparameters of kernel function cannot be adjusted when kernel functionGamma, it seems that only the default can be used;LIBSVMcan be adjusted for this parameter.
5 LIBSVMThe solution algorithm for the two-time planning problem isSMO; andMATLABBring your ownSVMThere are three options for solving the two-time programming problem in the function: the classic two-time method;SMO; least squares. (This is what I've found now. )MATLABBring your ownSVMBenefits of implementing a function only~)
Excerpt from: http://www.ilovematlab.cn/thread-85860-1-1.html
SVM (Support vector machine)