Skip to content
No description, website, or topics provided.
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
man
tests
.Rbuildignore
.editorconfig
.gitignore
.travis.yml
DESCRIPTION
NAMESPACE
README.md
mlr3learnertemplate.Rproj

README.md

mlr3learnertemplate

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.

Instructions

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 https://github.com/mlr-org/mlr3learners)

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.

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:

devtools::check()
You can’t perform that action at this time.