Hello

I am playing around trying to bootstrap an svm model using a training set and a test set.  I've written another function, auc, which I call here, and am bootstrapping.  I did this successfully with logistic regression, but I am getting an error from the starred **  line which I determined with print statements.  How do I tune an svm in a bootstrap?  I can't find sample code anywhere.

Code:

library(e1071)
library(boot)
source("hw2a.r")
D <- read.csv("colonoscopy.csv", header=T)
E <- read.csv("CLStest.csv", header=T)

dataclstraining <- subset(D,select=c(....))
classesclstraining <- subset(D, select=Class)
dataclstest <- subset(E,select=c(.......))
classesclstest <- subset(E, select=Class)

bootsvm <- function(data, new_data, newdata_classes, indices)
{
 d <-data[indices,]
** model2 <- best.svm(Class~.,data=d, gamma = 10^(-6:-1), cost = 10^(-1:1), tunecontrol=tune.control(sampling="bootstrap", nboot=1000, boot.size=8/8))
 pred.b <- predict(model2, newdata=new_data, decision.values=FALSE, probability=FALSE)

 return(auc(pred.b, t(newdata_classes)))
}
colon.boot <- boot(data=dataclstraining, statistic=bootsvm, R=1000, new_data=dataclstest, newdata_classes=classesclstest)
ci <- boot.ci(colon.boot)

print(summary(colon.boot$t))
print(ci)

Can anyone point out what I am doing wrong?  I am getting a whole host of errors no matter what I use for the best.svm line.  Some variants I have tried include trying to use the validation.x, validation.y parameters for tune, but I have no clue how to use them or what they are for.  I have also tried the following line:

model <- best.svm(Class~.,data=dataclstraining, gamma = 10^(-7:-2), cost = 10^(-2:1), tunecontrol=tune.control(cross=8, sampling="cross"))

to no avail.  I get NaN/Inf (arg 4) errors.  I am so stuck.  Please help.

Thank you.

Vaibhav

	[[alternative HTML version deleted]]

