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 the following files to suit your learner:
(For regression use the prefix "Regr" instead of "Classif". For example learners see https://github.com/mlr-org/mlr3learners)
- Adapt the documentation to suit your learner.
- Adapt names and the package, learner properties, etc. This is outlined in the book
R/zzz.R. The code in the
.onLoadfunction is executed on package load and adds the learner to the
- Name your package and GitHub repository
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() expect_learner(learner) result = run_autotest(learner) expect_true(result, info = result$error)
Check your package
If this runs, your learner should be fine: