# NOT RUN {
library("SuperLearner")
library("gam")
n <- 100
p <- 2
## generate the data
x <- data.frame(replicate(p, stats::runif(n, -5, 5)))
## apply the function to the x's
smooth <- (x[,1]/5)^2*(x[,1]+7)/5 + (x[,2]/3)^2
## generate Y ~ Normal (smooth, 1)
y <- as.matrix(smooth + stats::rnorm(n, 0, 1))
## set up a library for SuperLearner
learners <- c("SL.mean", "SL.gam")
## run the Super Learner
set.seed(4747)
fitted_lst <- run_sl(y, x, V = 5, SL.library = learners, s = )
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab