I'm running a support vector machine with a radial basis kernel function in the R caret
package. My code runs without errors or warnings, however it generates a "maximum number of iterations reached ..." message which I interpret as meaning the algorithm didn't converge to a solution.
Using a small college admissions dataset (4 features, n=400) as an example:
# Load data & factor admit variable.
> mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
mydata$admit <- as.factor(mydata$admit)
# Create levels yes/no to make sure the the classprobs get a correct name.
levels(mydata$admit) = c("yes", "no")
# Train SVM via 10-fold CV.
set.seed(123)
train_control <- trainControl( method="cv",
number=10,
classProbs = TRUE,
savePredictions = TRUE)
model_rbfsvm<- train(as.factor(admit) ~ .,
data=mydata,
trControl=train_control,
method="svmRadial",
family="binomial",
tuneGrid=expand.grid(C=c(.000001, .00001, .0001, .001, .01, .1, 1, 10), sigma=c(.00001, .0001, .001, .01, .1, 1, 10)),
metric="Accuracy",
preProcess=c("center","scale"))
successfully executes but produces the following message (I've abbreviated - it goes on for many lines):
maximum number of iterations reached 4.663775e-05 4.663771e-05maximum number of iterations reached 0.0003396917 0.0003396878...
Adjusting the maximum number of iterations with the maxiter=
statement in the train function produced the same message.
Is it possible to adjust the maximum number of iterations in caret
or is it fixed at a specific level?