Description Usage Arguments Value Examples
Recompute the super learner estimator from a SuperLearner
fit
based on a restricted set of candidate learners and/or a different loss
function than initially fit.
Note that this function does not check for errors in the original SuperLearner
fit library as well as the SuperLearner function does. In essence, I'm assuming
you've already decided to get rid of the learners that had errors in the initial
fitting procedure for computing this new Super Learner.
1 2 |
fit |
An object of class |
newLibrary |
A character vector of a subset of |
newMethod |
A |
obsWeights |
The weights used to compute the original Super Learner fit. Because these weights are not
returned with the |
verbose |
Passed to the method functions to print option messages. |
... |
Other options. Currently not used. |
An object of \classSuperLearner with modifications recorded. See ?SuperLearner
for details.
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 | n <- 100
X <- data.frame(x1=runif(n), x2=rnorm(n), x3=rbinom(n,1,0.5))
Y <- rnorm(n, X$x1 + X$x3)
# fit a super learner with library of three
set.seed(1234)
sl1 <- SuperLearner(Y=Y, X=X, SL.library=c("SL.glm","SL.gam","SL.mean"))
# recompute super learner omitting SL.gam
sl2 <- modifySL(fit = sl1, newLibrary = c("SL.glm_All","SL.mean_All"))
# should be the same as this super learner
set.seed(1234)
sl3 <- SuperLearner(Y=Y, X=X, SL.library=c("SL.glm","SL.mean"))
# can also modify super learner method
sl4 <- modifySL(fit = sl1, newMethod = "method.CC_LS")
# should be the same as this
set.seed(1234)
sl5 <- SuperLearner(Y=Y, X=X, SL.library = c("SL.glm","SL.gam","SL.mean"),
method = "method.CC_LS")
# can also modify both simultaneously
sl6 <- modifySL(fit = sl1, newLibrary = c("SL.glm_All","SL.mean_All"),
newMethod = "method.CC_LS")
# same as this
set.seed(1234)
sl7 <- SuperLearner(Y=Y, X=X, SL.library = c("SL.glm","SL.mean"),
method = "method.CC_LS")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.