# NOT RUN {
## Survival response example
library(MASS)
fo <- medv ~ .
# User-specified grid
(gbmtune1 <- tune(fo, data = Boston, model = GBMModel,
grid = expand.grid(n.trees = c(25, 50, 100),
interaction.depth = 1:3,
n.minobsinnode = c(5, 10)),
control = CVControl(folds = 10, repeats = 5)))
# Automatically generated grid
(gbmtune2 <- tune(fo, data = Boston, model = GBMModel, grid = 3,
control = CVControl(folds = 10, repeats = 5)))
# Randomly sampled grid points
(gbmtune3 <- tune(fo, data = Boston, model = GBMModel,
grid = Grid(length = 1000, random = 10),
control = CVControl(folds = 10, repeats = 5)))
summary(gbmtune3)
plot(gbmtune3, type = "line")
gbmfit <- fit(fo, data = Boston, model = gbmtune3)
varimp(gbmfit)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab