| SuperLearner_tidiers | R Documentation |
This method extends tidy to tidy the results from a
SuperLearner fit (screening, prediction, or
both) into a summary.
## S3 method for class 'SuperLearner'
tidy(
x,
algorithm = c("prediction", "screening", "both"),
stringsAsFactors = FALSE,
...
)
x |
object of class |
algorithm |
one of "prediction" (the default), "screening", or "both" (where "both" indicates that information on both "prediction" and "screening" should be reported). |
stringsAsFactors |
Set to |
... |
passed through to internal functions handling summaries of
feature selection and/or prediction models (depending on the supplied value
for |
This method can be used to summarize information related to the screening algorithm(s), prediction algorithm(s), or both.
A data.frame without rownames. Column names included depend
on the supplied value for algorithm.
If algorithm is set to "screening" or "both", the optional argument
includeAll can be set to TRUE to include results from the
pass-thru screening algorithm, "All". By default, includeAll
is set to FALSE and these results are excluded.
data.frameColumns in resulting data.frame depend upon selected algorithm:
One row per element in SL.library. Five columns:
Coefficient estimate
Estimate of cross-validated risk.
Screening algorithm
Prediction algorithm
Logical. Is this the discrete SuperLearner?
Number of rows equal to the product of
[number columns in X] and
[number of unique screening algorithms in SL.library, not
including "All" (by default)].
Three columns:
Screening algorithm
Column of X
Logical. Did the screening algorithm select
this column of X?
Number of rows equal to the product of
[number columns in X] and
[number of elements in SL.library, not including any elements
where the screening algorithm was set to "All" (by default)].
Seven columns constituting the union of the columns returned
for "prediction" and "screening" (described above).
tidy.CV.SuperLearner
# based on an example in the SuperLearner package
set.seed(1)
n <- 100
p <- 10
X <- matrix(rnorm(n*p), nrow = n, ncol = p)
X <- data.frame(X)
Y <- rbinom(n, 1, plogis(.2*X[, 1] + .1*X[, 2] - .2*X[, 3] + .1*X[, 3]*X[, 4] - .2*abs(X[, 4])))
library(SuperLearner)
sl = SuperLearner(Y, X, family = binomial(), cvControl = list(V = 2),
SL.library = list(c("SL.mean", "screen.wgtd.corP"),
c("SL.mean", "screen.wgtd.ttest"),
c("SL.glm", "screen.wgtd.corP"),
c("SL.glm", "screen.wgtd.ttest")))
library(broom)
tidy(sl)
tidy(sl, algorithm = "screening")
tidy(sl, algorithm = "both")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.