I am new to machine learning and currently reading a paper about a ANN modelling in which they have divided their dataset into Training , validation and testing set. I have carried out some minor SVM regression studies of my own using R (e1071); in which I have used only Training Set and testing set but no validation test to create model. I have optimized cost and gamma of my SVR model using inbuilt tune() function.

And this is a sample code

data = data.frame(matrix(rnorm(100*5), nrow=100))
op=tune(svm,X1 ~ ., data=train,kernel="radial",ranges=list(cost=c(0.001,0.01),gamma=c(0.5,0.1)))
fit = op$best.model

So is it necessary to use validation set in SVR. if yes how can I programmatically implement validation set in the above code.


1 Answer 1


Actually, the "tune" function already split the data into training and validation set and performs, automatically, the cross-validation (10 fold) of your data. The default parameter of the "tune" function can be found by typing "?tune.control" in R console.

So, what you did in your code was correct!

Obs.: If you want to use the function svm directly, you should split between training, validation and test set and implement, for example, the cross-validation of the models.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.