Skip to content

Instantly share code, notes, and snippets.

@sriyoda
Created March 30, 2016 15:53
Show Gist options
  • Save sriyoda/025de89e8d8787f093af91f3d5e68c25 to your computer and use it in GitHub Desktop.
Save sriyoda/025de89e8d8787f093af91f3d5e68c25 to your computer and use it in GitHub Desktop.
gbmFit.ada = gbm(formula = ylearn ~.,
distribution = 'adaboost',
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_ada = predict(gbmFit.ada, test_data, n.trees = best.cv.ada, type = 'response')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment