ecpolley / SuperLearner

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

using snow: do wrappers really need to be added to the SuperLearner namespace? #150

Open rdiaz02 opened 6 months ago

rdiaz02 commented 6 months ago

The documentation (e.g., p. 55 in the current https://cran.r-project.org/web/packages/SuperLearner/SuperLearner.pdf ; the Examples section of the help for SuperLearner) says

snow example with user-generated wrappers If you write your own wrappers and are using snowSuperLearner() These new wrappers need to be added to the SuperLearner namespace and exported to the clusters Using a simple example here, but can define any new SuperLearner wrapper my.SL.wrapper <- function(...) SL.glm(...) assign function into SuperLearner namespace environment(my.SL.wrapper) <-asNamespace("SuperLearner")

However, as far as I can tell, adding the wrappers to the namespace is not necessary (exporting them to the cluster is necessary). I did not read this thoroughly the first time, and I've been using SuperLearner with snow clusters and my custom wrappers without adding them to the namespace; I actually do not understand why it would be necessary to add them to the namespace so I am hesitant to do it. What am I missing?