StefTaki
StefTaki

Reputation: 13

SVM method cross validation , tune function

I have a problem in function tune, and i have this error.Please help.

Error in tune("svm", train.x = x, data = data, ranges = ranges, ...) : formal argument "ranges" matched by multiple actual arguments

library(e1071)
data3$'rez'<-as.factor(data3$'rez') 
table(data3$'rez')
index<-sample(nrow(data3),floor(0.8*nrow(data3))) 
train<-data3[index,]
valid<-data3[-index,]
tuned<-tune.svm(rez~., data = train,kernel="radial", ranges=list(gamma=2^(-1:1),cost=2^(2:4)))
summary(tuned) 

Our data is at https://www.dropbox.com/s/6fsce4pgwjhoo9t/train.csv?dl=0

Upvotes: 1

Views: 575

Answers (1)

LMc
LMc

Reputation: 18612

You have misspecified the arguments for tune.svm. It should be:

tuned<-tune.svm(rez~., data = train,kernel="radial", gamma=2^(-1:1),cost=2^(2:4))

The syntax you have written would work if you did:

tuned<-tune(svm, rez~., data = train,kernel="radial", ranges=list(gamma=2^(-1:1),cost=2^(2:4)))

Upvotes: 1

Related Questions