# NOT RUN {
## Numeric response example
fo <- sale_amount ~ .
# User-specified grid
(gbm_tune1 <- tune(fo, data = ICHomes, model = GBMModel,
grid = expand_params(n.trees = c(25, 50, 100),
interaction.depth = 1:3,
n.minobsinnode = c(5, 10)),
control = CVControl(folds = 10, repeats = 5)))
# Automatically generated grid
(gbm_tune2 <- tune(fo, data = ICHomes, model = GBMModel, grid = 3,
control = CVControl(folds = 10, repeats = 5)))
# Randomly sampled grid points
(gbm_tune3 <- tune(fo, data = ICHomes, model = GBMModel,
grid = Grid(length = 1000, random = 10),
control = CVControl(folds = 10, repeats = 5)))
summary(gbm_tune1)
plot(gbm_tune1, type = "line")
gbm_fit <- fit(fo, data = ICHomes, model = gbm_tune1)
varimp(gbm_fit)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab