APM_Exercises icon indicating copy to clipboard operation
APM_Exercises copied to clipboard

setting n.minobsinnode in Ch08

Open bowerth opened this issue 7 years ago • 1 comments

https://topepo.github.io/caret/model-training-and-tuning.html#basic-parameter-tuning

For a gradient boosting machine (GBM) model, there are three main tuning parameters:

  • ...
  • the minimum number of training set samples in a node to commence splitting (n.minobsinnode)
<<ch08_permeabilityGBMTune, echo = TRUE, eval = TRUE, cache = TRUE>>=
set.seed(614)
gbmGrid <- expand.grid(interaction.depth=seq(1,6,by=1),
                       n.trees=c(25,50,100,200),
                       shrinkage=c(0.01,0.05,0.1))
gbmPermTune <- train(x = trainFingerprints, y = log10(trainPermeability),
                     method = "gbm",
                     verbose = FALSE,
                     tuneGrid = gbmGrid,
                     trControl = ctrl)
@
Error: The tuning parameter grid should have columns n.trees, interaction.depth, shrinkage, n.minobsinnode

bowerth avatar Jul 18 '17 11:07 bowerth

Sinew the book was written, an extra tuning parameter was added to the model code. You can use

gbmGrid <- expand.grid(interaction.depth=seq(1,6,by=1),
                       n.trees=c(25,50,100,200),
                       shrinkage=c(0.01,0.05,0.1),
                       n.minobsinnode = 10)

topepo avatar Aug 25 '17 00:08 topepo