https://github.com/nt-williams/mlr3superlearner
Super learner fitting and prediction using mlr3
https://github.com/nt-williams/mlr3superlearner
ensemble-learning machine-learning
Last synced: 5 months ago
JSON representation
Super learner fitting and prediction using mlr3
- Host: GitHub
- URL: https://github.com/nt-williams/mlr3superlearner
- Owner: nt-williams
- License: gpl-3.0
- Created: 2023-05-03T00:55:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-20T21:25:49.000Z (over 1 year ago)
- Last Synced: 2025-02-20T22:28:16.096Z (over 1 year ago)
- Topics: ensemble-learning, machine-learning
- Language: R
- Homepage:
- Size: 89.8 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# mlr3superlearner
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/nt-williams/mlr3superlearner/actions/workflows/R-CMD-check.yaml)
An modern implementation of the [Super Learner](https://biostats.bepress.com/ucbbiostat/paper266/) prediction algorithm using the [mlr3](https://mlr3.mlr-org.com/) framework, and an adherence to the recommendations of [Phillips, van der Laan, Lee, and Gruber (2023)](https://doi.org/10.1093/ije/dyad023)
## Installation
You can install the development version of mlr3superlearner from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("nt-williams/mlr3superlearner")
```
## Example
```{r example}
library(mlr3superlearner)
library(mlr3extralearners)
# No hyperparameters
mlr3superlearner(mtcars, "mpg", c("mean", "glm", "svm", "ranger"), "continuous")
# With hyperparameters
fit <- mlr3superlearner(mtcars, "mpg",
list("mean", "glm", "xgboost", "svm", "earth",
list("nnet", trace = FALSE),
list("ranger", num.trees = 500, id = "ranger1"),
list("ranger", num.trees = 1000, id = "ranger2")),
"continuous")
fit
head(data.frame(pred = predict(fit, mtcars), truth = mtcars$mpg))
```
## Available learners
```{r}
knitr::kable(available_learners("binomial"))
knitr::kable(available_learners("continuous"))
```