SVM参数寻优:grid search

grid search和穷举法比较类似。就是找到所有的组合一一实验。cross validation就比如五层交叉验证,每次拿样本的1/5测试,其他都拿去训练。循环五次之后求平均值。bestcg就是通过grid search找到最小cross validation误差的那一组cg.

使用svm,无论是libsvm还是svmlight,都需要对参数进行设置。以RBF核为例,在《A Practical Guide to Support Vector Classi cation》一文中作者提到在RBF核中有2个参数:C和g。对于一个给定的问题,我们事先不知道C和g取多少最优,因此我们要进行模型选择(参数搜索)。这样做的目标是找到好的(C, g)参数对,使得分类器能够精确地预测未知的数据,比如测试集。需要注意的是在在训练集上追求高精确度可能是没用的(意指泛化能力)。根据前一部分所说的,衡量泛化能力要用到交叉验证。
在文章中作者推荐使用“网格搜索”来寻找最优的C和g。所谓的网格搜索就是尝试各种可能的(C, g)对值,然后进行交叉验证,找出使交叉验证精确度最高的(C, g)对。“网格搜索”的方法很直观但是看起来有些原始。事实上有许多高级的算法,比如可以使用一些近似算法或启发式的搜索来降低复杂度。但是我们倾向于使用“网格搜索”这一简单的方法。

英语论文表达:

To choose parameters of the model, this paper adopted the method of cross validation based on grid search, avoiding the arbitrary and capricious behav 

To acquire accuracy and stability, we apply 10-fold cross validation and a grid-search technique to 

The selection of the kernel parameters in SVM is a long-standing question. Empirically, cross-validation with grid-search is the most popular method 

Based on the validation set, the best pair of parameters is grid-searched in the range of [2 −2 ,2 2 ] and [θ 0 ,θ 1 ], respectively, for γ and θ.

C and the kernel width parameter γ were optimized using a grid search approach.

 
原文地址:https://www.cnblogs.com/ycjing/p/5331936.html