Type: | Package |
Title: | Super Learner Fitting and Prediction |
Version: | 0.1.2 |
Description: | An implementation of the Super Learner prediction algorithm from van der Laan, Polley, and Hubbard (2007) <doi:10.2202/1544-6115.1309 using the 'mlr3' framework. |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
Imports: | checkmate, lgr, mlr3, data.table, purrr, cli, glmnet |
RoxygenNote: | 7.3.2 |
Depends: | mlr3learners |
Suggests: | ranger, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2024-09-17 16:08:19 UTC; nicholaswilliams |
Author: | Nicholas Williams |
Maintainer: | Nicholas Williams <ntwilliams.personal@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-09-17 16:30:06 UTC |
Learners Available for Use
Description
Learners Available for Use
Usage
available_learners(outcome_type = c("binomial", "continuous"))
Arguments
outcome_type |
The outcome variable type. |
Value
A data.table
of available learners.
Examples
available_learners("binomial")
Super Learner Algorithm
Description
Implementation of the Super Learner algorithm using the 'mlr3' framework. By default, returning the discrete Super Learner. If using the ensemble Super Learner, The LASSO with an alpha value of 0 and a restriction on the lower limit of the coefficients is used as the meta-learner.
Usage
mlr3superlearner(
data,
target,
library,
outcome_type = c("binomial", "continuous"),
folds = NULL,
discrete = TRUE,
newdata = NULL,
group = NULL,
info = FALSE
)
Arguments
data |
[ |
target |
[ |
library |
[ |
outcome_type |
[ |
folds |
[ |
discrete |
[ |
newdata |
[ |
group |
[ |
info |
[ |
Value
A list of class mlr3superlearner
.
Examples
if (requireNamespace("ranger", quietly = TRUE)) {
n <- 1e3
W <- matrix(rnorm(n*3), ncol = 3)
A <- rbinom(n, 1, 1 / (1 + exp(-(.2*W[,1] - .1*W[,2] + .4*W[,3]))))
Y <- rbinom(n,1, plogis(A + 0.2*W[,1] + 0.1*W[,2] + 0.2*W[,3]^2 ))
tmp <- data.frame(W, A, Y)
mlr3superlearner(tmp, "Y", c("glm", "ranger"), "binomial")
}
Predict method for mlr3superlearner
object
Description
Predict method for mlr3superlearner
object
Usage
## S3 method for class 'mlr3superlearner'
predict(object, newdata, ...)
Arguments
object |
[ |
newdata |
data [ |
... |
Unused. |
Value
A vector of the predicted values.
See Also
Examples
if (requireNamespace("ranger", quietly = TRUE)) {
n <- 1e3
W <- matrix(rnorm(n*3), ncol = 3)
A <- rbinom(n, 1, 1 / (1 + exp(-(.2*W[,1] - .1*W[,2] + .4*W[,3]))))
Y <- rbinom(n,1, plogis(A + 0.2*W[,1] + 0.1*W[,2] + 0.2*W[,3]^2 ))
tmp <- data.frame(W, A, Y)
fit <- mlr3superlearner(tmp, "Y", c("glm", "ranger"), "binomial")
predict(fit, tmp)
}