Skip to content

Instantly share code, notes, and snippets.

View apapiu's full-sized avatar

Alexandru Papiu apapiu

View GitHub Profile
@apapiu
apapiu / rf_xgb.R
Last active April 29, 2016 23:01
Random Forest of Xgboosts
# 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