What steps will reproduce the problem?
1. run a gbm model with cv.folds=0
2. call predict.gbm(model)
The error you will see is from this line in the source for predict.gbm:
cat(paste("Using", n.trees, "trees...\n"))
and is caused by this line immediately above:
best <- length(object$train.error)
The variable 'best' is never referenced again, I believe this is simple bug and
n.trees should be set to the length of object$train.error if n.trees is not
specified in the arguments.
This is bug arises in version 2.1 of gbm.
Original issue reported on code.google.com by kei...@datagami.info on 29 Jan 2015 at 8:30
Original issue reported on code.google.com by
kei...@datagami.info
on 29 Jan 2015 at 8:30