You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to help with user migration, it would be really nice to have a "translation guide" for experienced users of the SuperLearner package to use sl3. This would take the place of a "SuperLearner3()" style wrapper function, instead helping users to find the correct sl3 idiom(s) to use in place of a given SuperLearner function or argument. An example of such would be the following:
library(SuperLearner)
library(sl3)
set.seed(57192)
# toy data
n <- 1000
p <- 3
x <- as.data.frame(replicate(p, rnorm(n, mean = 0, sd = 1)))
y <- sin(x[, 1]) + x[, 2] + rnorm(n, mean = 0, sd = 0.3)
dat <- as.data.frame(cbind(x, y))
# using SuperLearner
sl_lib <- c("SL.mean", "SL.glm")
sl_old <- SuperLearner(Y = y, X = x, SL.library = sl_lib)
y_pred_old <- predict(sl_old)$pred
# using sl3
sl_task <- make_sl3_Task(covariates = colnames(dat)[seq_len(p)], outcome = "y", data = dat)
sl3_lib <- make_learner_stack("Lrnr_mean", "Lrnr_glm_fast")
sl_new <- Lrnr_sl$new(learners = sl3_lib, metalearner = Lrnr_nnls$new())
sl_trained <- sl_new$train(sl_task)
y_pred_new <- sl_trained$predict()
# squared error difference
mean((y_pred_old - y_pred_new)^2)
...with the point being that an experience user (of SuperLearner, new to sl3) would be able to easily pick up the similarities between, for example, make_learner_stack and SL.library or calling the R6 .$predict method of the trained sl3 model vs. the S3 predict(...) method for an object of class SuperLearner. This is just an early-stage idea and could definitely use refinement and input from further discussion.
The text was updated successfully, but these errors were encountered:
In order to help with user migration, it would be really nice to have a "translation guide" for experienced users of the
SuperLearner
package to usesl3
. This would take the place of a "SuperLearner3()
" style wrapper function, instead helping users to find the correctsl3
idiom(s) to use in place of a givenSuperLearner
function or argument. An example of such would be the following:...with the point being that an experience user (of
SuperLearner
, new tosl3
) would be able to easily pick up the similarities between, for example,make_learner_stack
andSL.library
or calling the R6.$predict
method of the trainedsl3
model vs. the S3predict(...)
method for an object of classSuperLearner
. This is just an early-stage idea and could definitely use refinement and input from further discussion.The text was updated successfully, but these errors were encountered: