Package website: release | dev
Extra Learners for mlr3.
What is mlr3extralearners?
mlr3extralearners contains all learners from mlr3 that are not in mlr3learners or the core packages. An overview of all learners within the mlr3verse can be found here.
mlr3extralearners lives on GitHub and will not be on CRAN.
You can install the package as follows:
# latest GitHub release
pak::pak("mlr-org/mlr3extralearners@*release")
# development version
pak::pak("mlr-org/mlr3extralearners")Alternatively, you can add the following to your .Rprofile, which allows you to install mlr3extralearners via install.packages().
Quick Start
The package includes functionality for detecting if you have the required packages installed to use a learner, and ships with the function install_learner which can install all required learner dependencies.
library(mlr3extralearners)
lrn("regr.gbm")
#> Warning: Package 'gbm' required but not installed for Learner 'regr.gbm'
#> <LearnerRegrGBM:regr.gbm>: Gradient Boosting
#> * Model: -
#> * Parameters: keep.data=FALSE, n.cores=1
#> * Packages: mlr3, mlr3extralearners, gbm
#> * Predict Types: [response]
#> * Feature Types: integer, numeric, factor, ordered
#> * Properties: importance, missings, weights
install_learners("regr.gbm")
learner = lrn("regr.gbm")
learner
#> <LearnerRegrGBM:regr.gbm>: Gradient Boosting
#> * Model: -
#> * Parameters: keep.data=FALSE, n.cores=1
#> * Packages: mlr3, mlr3extralearners, gbm
#> * Predict Types: [response]
#> * Feature Types: integer, numeric, factor, ordered
#> * Properties: importance, missings, weightsYou can now use the learner to fit a model and make predictions.
task = tsk("california_housing")
task
#>
#> ── <TaskRegr> (20640x10): California House Value ───────────────────────────────
#> • Target: median_house_value
#> • Properties: -
#> • Features (9):
#> • dbl (8): households, housing_median_age, latitude, longitude,
#> median_income, population, total_bedrooms, total_rooms
#> • fct (1): ocean_proximity
split = partition(task)
learner$train(task, split$train)
#> Distribution not specified, assuming gaussian ...
learner$predict(task, split$test)
#>
#> ── <PredictionRegr> for 6811 observations: ─────────────────────────────────────
#> row_ids truth response
#> 6 269700 267521.73
#> 15 159200 206521.92
#> 19 158700 186987.58
#> --- --- ---
#> 20635 116800 138468.71
#> 20638 92300 81523.13
#> 20640 89400 93127.56You can learn more about using learners by reading our book.
Extending mlr3extralearners
An in-depth tutorial on how to add learners can be found in the package website.
Acknowledgements
This R package is developed as part of the Mathematical Research Data Initiative.
Citing mlr3extralearners
If you use mlr3extralearners, please cite our JOSS paper:
@Article{Fischer2025,
title = {mlr3extralearners: {E}xpanding the mlr3 {E}cosystem with {C}ommunity-{D}riven {L}earner {I}ntegration},
author = {Sebastian Fischer and John Zobolas and Raphael Sonabend and Marc Becker and Michel Lang and Martin Binder and Lennart Schneider and Lukas Burk and Patrick Schratz and Byron C. Jaeger and Stephen A. Lauer and Lorenz A. Kapsner and Maximilian Mücke and Zezhi Wang and Damir Pulatov and Keenan Ganz and Henri Funk and Liana Harutyunyan and Pierre Camilleri and Philipp Kopper and Andreas Bender and Baisu Zhou and Niko German and Lona Koers and Anna Nazarova and Bernd Bischl},
journal = {Journal of Open Source Software},
year = {2025},
volume = {10},
number = {115},
pages = {8331},
doi = {10.21105/joss.08331},
}