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", "mlr3_package", "required_packages"))
#>                      id      mlr3_package
#>                  <char>            <char>
#>   1: classif.AdaBoostM1 mlr3extralearners
#>   2:       classif.bart mlr3extralearners
#>   3:        classif.C50 mlr3extralearners
#>   4:   classif.catboost mlr3extralearners
#>   5:    classif.cforest mlr3extralearners
#>  ---                                     
#> 130:        surv.ranger mlr3extralearners
#> 131:         surv.rfsrc mlr3extralearners
#> 132:         surv.rpart         mlr3proba
#> 133:           surv.svm mlr3extralearners
#> 134:       surv.xgboost mlr3extralearners
#>                                            required_packages
#>                                                       <list>
#>   1:                            mlr3,mlr3extralearners,RWeka
#>   2:                           mlr3,mlr3extralearners,dbarts
#>   3:                              mlr3,mlr3extralearners,C50
#>   4:                         mlr3,mlr3extralearners,catboost
#>   5:           mlr3,mlr3extralearners,partykit,sandwich,coin
#>  ---                                                        
#> 130:                 mlr3,mlr3proba,mlr3extralearners,ranger
#> 131: mlr3,mlr3proba,mlr3extralearners,randomForestSRC,pracma
#> 132:                    mlr3,mlr3proba,rpart,distr6,survival
#> 133:            mlr3,mlr3proba,mlr3extralearners,survivalsvm
#> 134:                mlr3,mlr3proba,mlr3extralearners,xgboost

mlr3extralearners lives on GitHub and will not be on CRAN. Install with:

remotes::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.