0

I am trying to fit a model with the SuperLearner package. However, I can't even get past the stage of playing with the package to get comfortable with it.... I use the following code:

superlearner<-SuperLearner::SuperLearner(Y=y, X=as.data.frame(data_train[1:30]), family =binomial(), SL.library = list("SL.glmnet"), obsWeights = weights)

y is a numeric vector of the same length as my dataframe "data_train", containing the correct labels with 9 different classes. The dataframe "data_train" contains 30 columns with numeric data.

When i run this, i get the Error:

Error in get(library$screenAlgorithm[s], envir = env) : 
  Objekt 'All' not found

I don't really know what the problem could be and i can't really wrap my head around the source code. Please note that the variable obsWeights in the function contains a numeric vector of the same length as my data with weights i calculated for the model. This shouldn't be the problem, as it doesn't work either way.

Unfortunately i can't really share my data on here, but maybe someone had this error before...

Thanks!

r-newbie
  • 11
  • 1
  • An odd error for sure! I don't think it has anything to do with your data. It is possible that you have a conflicting library, but that doesn't seem likely either. If you're using RStudio, in the Environment pane, click on the down arrow next to 'Global Environment' and select package::SuperLearner. `All` should be the first function in their environment. (Make sure to switch back to global.) If it's missing, try reinstalling the package. For an interim fix: `All = function(X, ...){rep.int(TRUE, ncol(X))}` will work. – Kat Mar 29 '22 at 18:19

1 Answers1

0

this seems to happen if you do not attach SuperLearner, you can fix via library(SuperLearner)