## Not run: ------------------------------------
# # To run before using LauraeML
# library(doParallel)
# library(foreach)
# mcl <- makeCluster(4)
# invisible(clusterEvalQ(mcl, library("xgboost")))
# invisible(clusterEvalQ(mcl, library("data.table")))
# invisible(clusterEvalQ(mcl, library("Laurae")))
#
# # In case you are doing manual training, try this.
# # We suppose our data is in the variable "data" and labels in "label".
#
# folds <- Laurae::kfold(label, k = 5)
# temp_data <- list()
# temp_label <- list()
#
# for (i in 1:length(folds)) {
#
# temp_data[[i]] <- list()
# temp_data[[i]][[1]] <- Laurae::DTsubsample(data,
# kept = folds[[i]],
# remove = TRUE,
# low_mem = FALSE,
# collect = 0,
# silent = TRUE)
# temp_data[[i]][[2]] <- Laurae::DTsubsample(data,
# kept = folds[[i]],
# remove = FALSE,
# low_mem = FALSE,
# collect = 0,
# silent = TRUE)
# temp_label[[i]] <- list()
# temp_label[[i]][[1]] <- label[-folds[[i]]]
# temp_label[[i]][[2]] <- label[folds[[i]]]
#
# }
#
# clusterExport(mcl, c("temp_data", "temp_label"), envir = environment())
# registerDoParallel(cl = mcl)
#
# # This will not run correctly because it's not made to be used like that
# LauraeML_gblinear_par(x = c(1, 1, 1),
# y = rep(1, ncol(data)),
# mobile = NA,
# parallelized = mcl,
# maximize = TRUE,
# logging = NULL,
# data = temp_data,
# label = temp_label,
# folds = folds)
#
# # Stops the cluster
# registerDoSEQ()
# stopCluster(mcl)
# #closeAllConnections() # In case of emergency if your cluster do not answer
## ---------------------------------------------
Run the code above in your browser using DataLab