Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
gbmFit.bern = gbm(formula = ylearn ~.,
distribution = 'bernoulli',
data = xlearn,
n.trees = 10000, #the number of trees in the model
interaction.depth = 5, #each tree will evaluate five decisions
n.minobsinnode = 2, #the number of obs present to yield a terminal node, higher means more conservative fit
shrinkage = .01, #the learning rate, dictates how fast the algorithm moves across the loss gradient
bag.fraction = 0.5, #subsampling fraction, 0.5 is best
train.fraction = 0.8, #fraction of data for training
cv.folds = 5) #running five-fold cross-validation
test_data$preds_bern = predict(gbmFit.bern, test_data, n.trees =, type = 'response')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.