Solved – How to perform grid search effectively for tuning SVM parameters in cross validation

cross-validationrsvm

I have C and gamma parameters for RBF kernel to perform SVM classification through cross validation in R software. How to fix values for grid search to tune C and gamma parameters? For example I took grid ranging from [50 , 60 , 70 ….,600] for C and Gamma [ 0.05, 0.10,….,1]. I used a validation set for fine tuning the parameters. I fixed the gamma value and varied the C and got the optimum C value. Then I fixed the optimum C value and varied the gamma values to find the optimum gamma value. Is it right or are there any other way to perform effective grid search?

Best Answer

in R you can do this by using tune.svm function of e1071 package for eg

obj = tune.svm(x,y,cost=10:100,gamma=seq(0,3,0.1))

would give you best cost and gamma value

please note that the values for cost and gamma are for understanding purpose only