Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status

This packages provides a template for adding new learners for mlr3.

Creating the actual learners is covered in the mlr3book. This package serves as a starting point for learners to share with others.


This repository is a minimal working package with the randomForest learner. Fork this repository and adapt the code to your learner.

Rename Files

Rename the following files to suit your learner:

  • R/LearnerClassifRandomForest.R
  • tests/testthat/test_classif_randomForest.R

(For regression use the prefix "Regr" instead of "Classif". For example learners see

Edit R/Learner[YourLearner].R

  • Adapt the documentation to suit your learner.
  • Adapt names and the package, learner properties, etc. This is outlined in the book
  • Adapt R/zzz.R. The code in the .onLoad function is executed on package load and adds the learner to the mlr_learners dictionary.
  • Name your package and GitHub repository mlr3learners.<CRAN_package_name>

Test Your Learner

If you run devtools::load_all() the function run_autotest() is available in your global environment. The autotest query the learner for its properties to create a custom test suite of tasks for it. Make sure that at least the following is executed in the unit test tests/testthat/test_classif_your_learner.R (adept names to your learner):

learner = LearnerClassifRanger$new()
result = run_autotest(learner)
expect_true(result, info = result$error)

Check your package

If this runs, your learner should be fine:

You can’t perform that action at this time.