ecpolley / SuperLearner

Current version of the SuperLearner R package
272 stars 72 forks source link

Passing extra parameters to SuperLearner's main function #135

Closed Naeemkh closed 3 years ago

Naeemkh commented 3 years ago

On the following page, the number of threads for XGBoost is set to 1. Is there a way for the user to change that value. Or how can a user pass extra parameters to SuperLearner function? (something like ...)

https://github.com/ecpolley/SuperLearner/blob/master/R/SL.xgboost.R

ecpolley commented 3 years ago

You can create your own XGBoost wrapper function with a different value for the number of threads, this could either be the entire SL.xgboost() code copied and given a new name after the edit, or you can create a new function that calls the SL.xgboost() function with a different value for the parameter, for example:

SL.xgboost_thread4 <- function(nthread = 4, ...) SL.xgboost(nthread = nthread, ...)

The ... makes sure all other arguments are passed.

Naeemkh commented 3 years ago

Thanks @ecpolley, it resolves the problem.