Learn R Programming

vimp (version 2.0.1)

run_sl: Run a Super Learner for the provided subset of features

Description

Run a Super Learner for the provided subset of features.

Usage

run_sl(Y, X, V, SL.library, s, folds, ...)

Arguments

Y

the outcome

X

the covariates

V

the number of folds

SL.library

the library of candidate learners

s

the subset of interest

folds

the CV folds

...

other arguments to Super Learner

Value

a list of length V, with the results of predicting on the hold-out data for each v in 1 through V

Examples

Run this code
# 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