使用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.