Description Usage Arguments Details Value Examples
In general, the function passed to sl_control$optim_risk
should expect a named list
of outcomes (Y) and predictions (pred) in validation folds and should return a criteria by
which super learner weights may be optimized. The weights are input to the function via
sl_weight
and are optimized in the sl_control$weight_fn
. See
Examples section below for an example of the format of the input
list used
for sl_control$optim_risk
functions.
1 | optim_risk_sl_se(sl_weight, input, sl_control)
|
sl_weight |
A numeric vector of super learner weights corresponding to each
|
input |
A list where each entry corresponds to a validation fold. Each entry is a list
with entries: Y (univariate outcome for this validation fold), pred (matrix of predictions
from |
sl_control |
Super learner control options. |
In this case, the function computes cross-validated mean squared-error.
Numeric value of cross-validated mean squared-error
1 2 3 4 5 6 7 8 9 10 11 12 13 | # simulate data with proper format
# Y is one component of the multivariate outcome
# pred is the predictions made by learners
input <- list(Y = rnorm(50), pred = cbind(rnorm(50), rnorm(50)))
# made up weights
sl_weight <- c(0.5, 0.5)
# linear ensemble
sl_control <- list(ensemble_fn = "ensemble_linear")
# get risk
risk <- optim_risk_sl_se(sl_weight, input, sl_control)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.