This packages provides a template for adding new learners for mlr3.
Creating new learners is covered in detail in section "Adding new learners" in the mlr3book. This package serves as a starting point for learners to share with others.
This repository is a template repository to create a learner that aligns with existing mlr3 learners. Perform the following tasks to create your learner:
- Replace all instances of
<package>
with the name of the underlying package.<type>
with the learner type, e.g.Classif
orRegr
.<algorithm>
with the name of the algorithm, e.grandomForest
.
- Rename files following the same scheme as in 1).
- Check if the learner supports feature importance internally.
If yes, add a
importance()
method in the respective learner class. - Check if the learner supports out-of-bag error estimation internally.
If yes, add a
oob_error()
method in the respective learner class. - Add yourself as the maintainer in
DESCRIPTION
. - Set up Continuous Integration (CI).
The GitHub Actions YAML files live in
.github/workflows
.- Replace
<package>
in l.17 oftic.R
with the name of the package. - Update the "Paramtest" files in
inst/paramtest/
to ensure no parameter was forgotten in the learner. Make sure that the CI test passes for "Param Check". - Update the badge in
README.md
with the package name.
- Replace
- Run
devtools::document(roclets = c('rd', 'collate', 'namespace'))
to create the NAMESPACE and man/ files. - Leave the files in
man-roxygen
as they are - they will just work. - Run
usethis::use_tidy_description()
to formatDESCRIPTION
. - Test your learner locally by running
devtools::test()
- Check your package by running
rcmdcheck::rcmdcheck()
- Check if your learner complies with the mlr style guide.
- Ensure that the CI builds complete successfully (via the "Actions" menu in the repo).
- Check on last small details like the name of the learner package and for possible leftovers of the placeholders used in the template.
Last but not least go through
👉 this checklist 📄
to make sure your learner is ready for review.
After your learner is accepted, it can be added to mlr3learners.drat, making it installabe via the canonical install.packages()
function without the need to live on CRAN.
Resources for adding a new learner (summary)
- mlr3learners.template
- mlr3book section "Adding new learners" including FAQ
- Checklist prior to requesting a review
!Important!: Delete all instructions up to this point and just leave the part below.
Adds <algorithm1>
and <algorithm2>
from the {} package to {mlr3}.
Install the latest release of the package via
install.packages("mlr3learners.<package>")
by following the instructions in the mlr3learners.drat README.
Alternatively, you can install the latest version of {mlr3learners.} from Github with:
remotes::install_github("mlr3learners/mlr3learners.<package>")