When running the gbm function for a classification problem. I get the following error:
Error in res[flag, ] <- predictions : replacement has length zero
I would like to know why I get this error and how to solve it.
My data is about 77 numeric variables(intergers) to be used in the classification and the 1 grouping factor. No other variables are in the data. There is no missing data in the data. The grouping factor is coded as a factor (0,1) as required.
The structure of my data looks something like this:
$Group : Factor w/ 2 levels "0", "1"
$it1 : int
...
$it70 : int
my model looks like this:
mod_gbm <- gbm(Group~. distribution = "bernoulli", data=df,
n.trees=1000,shrinkage=.01, n.minobsinnode=5,
interaction.depth = 6, cv.folds=5)
I realize this question is very similar to the one here: Problems in using GBM function to do classification in R but that person was wondering about using a numeric variable and the only response was to remove cv.folds. I would like to keep cv.folds in my model and to have it run.