8

I have two lists of parameters (gamma and cost) that I want to select using a SVM. I want to do 5-fold crossvalidation, but my code makes 10-fold cross validation (which is the default). My code is looking like this:

prioir_svm <- tune.svm(train, y = trainY, cost = Cs, gamma = gammas, cross = 5)

Can anyone tell me what is wrong?

Mads Obi
  • 560
  • 3
  • 8
  • 17

1 Answers1

11

Try this instead:

tc <- tune.control(cross = 5)

prioir_svm <- tune.svm(train, y = trainY, cost = Cs, gamma = gammas,
tunecontrol = tc)

see ?tune.control for details

Zelazny7
  • 39,946
  • 18
  • 70
  • 84