cv_sl | R Documentation |
Cross-validated Super Learner
cv_sl(lrnr_sl, eval_fun)
lrnr_sl |
a |
eval_fun |
the evaluation function, either a loss or risk function, for evaluating the Super Learner's predictions. |
A list of containing the following: the table of cross-validated risk estimates of the super learner and the candidate learners used to construct it, and either a matrix of coefficients for the super learner on each fold or a list for the metalearner fit on each fold.
## Not run:
data(cpp_imputed)
cpp_task <- sl3_Task$new(
data = cpp_imputed,
covariates = c("apgar1", "apgar5", "parity", "gagebrth", "mage"),
outcome = "haz"
)
glm_lrn <- Lrnr_glm$new()
ranger_lrn <- Lrnr_ranger$new()
lasso_lrn <- Lrnr_glmnet$new()
sl <- Lrnr_sl$new(
learners = list(glm_lrn, ranger_lrn, lasso_lrn),
cv_control = list(V = 5),
verbose = FALSE
)
cv_sl_object <- cv_sl(
lrnr_sl = sl, eval_fun = loss_squared_error
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.