Skip to contents

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. mlr3extralearners contains helper functions to find where all the learners, across the mlr3verse, live and to install required packages to run these learners. See the interactive learner list for the full list of learners in the mlr3verse and the learner status page for a live build status.

list_mlr3learners(select = c("id", "required_packages"))
#> This will take a few seconds.
#>                      id                                       required_packages
#>                  <char>                                                  <list>
#>   1: classif.AdaBoostM1                            mlr3,mlr3extralearners,RWeka
#>   2:       classif.bart                           mlr3,mlr3extralearners,dbarts
#>   3:        classif.C50                              mlr3,mlr3extralearners,C50
#>   4:   classif.catboost                         mlr3,mlr3extralearners,catboost
#>   5:    classif.cforest           mlr3,mlr3extralearners,partykit,sandwich,coin
#>  ---                                                                           
#> 133:        surv.ranger                 mlr3,mlr3proba,mlr3extralearners,ranger
#> 134:         surv.rfsrc mlr3,mlr3proba,mlr3extralearners,randomForestSRC,pracma
#> 135:         surv.rpart                    mlr3,mlr3proba,rpart,distr6,survival
#> 136:           surv.svm            mlr3,mlr3proba,mlr3extralearners,survivalsvm
#> 137:       surv.xgboost                mlr3,mlr3proba,mlr3extralearners,xgboost

mlr3extralearners lives on GitHub and will not be on CRAN. You can download the latest release from here and install it locally with

devtools::install_local("path/to/mlr3extralearners")

If you want to download the development version, run

devtools::install_github("mlr-org/mlr3extralearners")

Installing and Loading Learners

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.

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")
lrn("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

Extending mlr3extralearners

New learners - either for personal use or to extend mlr3extralearners - can be created with the create_learner function. An in-depth tutorial on how to do this can be found in the mlr3 book.