Description Usage Arguments Value See Also Examples
This function allows you to use the learner fits from a previous call to cvma
to change options for how the super learner weights and outcome weights are computed.
The majority of the computation time in cvma
is spent fitting learners, while
the (re-)computation of weights is relatively quick. Thus, this function allows one
to obtain new results without the need to re-fit a trove of learners.
1 2 3 4 5 6 7 8 9 | reweight_cvma(object, Y, X, sl_control = list(ensemble_fn =
"ensemble_linear", optim_risk_fn = "optim_risk_sl_se", weight_fn =
"weight_sl_convex", cv_risk_fn = "cv_risk_sl_r2", family = gaussian(),
alpha = 0.05), y_weight_control = list(ensemble_fn = "ensemble_linear",
weight_fn = "weight_y_convex", optim_risk_fn = "optim_risk_y_r2",
cv_risk_fn = "cv_risk_y_r2", alpha = 0.05),
return_control = list(outer_weight = TRUE, outer_sl = TRUE, inner_sl =
FALSE, all_y = TRUE, all_learner_assoc = TRUE, all_learner_fits = FALSE),
scale = FALSE)
|
object |
An object of class |
Y |
A matrix or data.frame of outcomes. This is assumed to be the same matrix
or data.frame of outcomes used in the original call to |
X |
A matrix or data.frame of predictors. This is assumed to be the same matrix
or data.frame of outcomes used in the original call to |
sl_control |
A list with named entries ensemble_fn, optim_risk_fn, weight_fn,
cv_risk_fn, family. Available functions can be viewed with |
y_weight_control |
A list with named entries ensemble_fn, optim_risk_fn, weight_fn,
cv_risk_fn. Available functions can be viewed with |
return_control |
A list with named entries |
scale |
Standardize each outcome to be mean zero with standard deviation 1. This is assumed
to be the same value as in the original call to |
If return_outer_sl
is TRUE, it will return for each outcome Super Learner fit weights
and associated risk for each learner. In addition, it will return the fit for all learners based on
all folds. If return_outer_weight
is TRUE, it will return the weights for each outcome
obtained using V-1 cross-validation. If return_all_y
is TRUE, it will return for each
outcome cross-validated measure (nonparametric R-squared or AUC), confidence interval and associated
p-value.
TO DO: Re-write this documentation.
predict method
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | set.seed(1234)
library(SuperLearner)
library(future)
X <- data.frame(x1=runif(n=100,0,5), x2=runif(n=100,0,5))
Y1 <- rnorm(100, X$x1 + X$x2, 1)
Y2 <- rnorm(100, X$x1 + X$x2, 3)
Y <- data.frame(Y1 = Y1, Y2 = Y2)
# results for super learner and R^2 for convex
# combination of outcomes
fit <- cvma(Y = Y, X = X, V = 5,
learners = c("SL.glm","SL.mean"),
return_control = list(outer_weight = TRUE,
outer_sl = TRUE,
inner_sl = FALSE,
all_y = TRUE,
all_learner_assoc = TRUE,
all_learner_fits = TRUE))
# re-weight with discrete super learner and R^2
# for a single outcome
re_fit <- reweight_cvma(fit, Y = Y, X = X,
sl_control = list(ensemble_fn = "ensemble_linear",
optim_risk_fn = "optim_risk_sl_se",
weight_fn = "weight_sl_01",
cv_risk_fn = "cv_risk_sl_r2",
family = gaussian(),
alpha = 0.05),
y_weight_control = list(ensemble_fn = "ensemble_linear",
weight_fn = "weight_y_01",
optim_risk_fn = "optim_risk_y_r2",
cv_risk_fn = "cv_risk_y_r2",
alpha = 0.05))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.