This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# X is the training matrix, y are the labels. | |
library(xgboost) | |
n = 100 | |
nrows = dim(X)[1] | |
nfeats = dim(X)[2] | |
replicate(n, { | |
boot_sample <- sample(1:nrows, replace = TRUE) | |
features_selected <- sample(1:nfeats, sqrt(nfeats)) #seems to work better for bagging |