library(car)
library(caret)
trainIndex <- createDataPartition(Prestige$income, p=.7, list=F)
prestige.train <- Prestige[trainIndex, ]
prestige.test <- Prestige[-trainIndex, ]
my.grid <- expand.grid(.decay = c(0.5, 0.1), .size = c(5, 6, 7))
prestige.fit <- train(income ~ prestige + education, data = prestige.train,
method = "nnet", maxit = 1000, tuneGrid = my.grid, trace = F, linout = 1)
prestige.predict <- predict(prestige.fit, newdata = prestige.test)
prestige.rmse <- sqrt(mean((prestige.predict - prestige.test$income)^2))
The above was discussed here How to train and validate a neural network model in R?
- Does caret package run many times for combinations of decay and size? If so, what is the default # of iterations?
- What is the final choice of decay and size? When I do
summary(prestige.fit)
, the decay is 0.5 and size is 5. Is that the final combination that caret chose as best option?