create_learner.Rd
Helper function to generate all required files, and fill in fields, for new learners.
create_learner( pkg = ".", classname, algorithm, type, key = tolower(classname), package = tolower(classname), caller, feature_types, predict_types, properties = NULL, references = FALSE, gh_name )
pkg |
|
---|---|
classname |
|
algorithm |
|
type |
|
key |
|
package |
|
caller |
|
feature_types |
|
predict_types |
|
properties |
|
references |
|
gh_name |
|
This function does the following:
Creates a learner_package_type_key.R file for the implemented learner.
Creates a test_package_type_key.R file for unit testing the learner.
Creates a test_paramtest_package_type_key.R file for testing correct implementation of learner parameters.
Creates a test_package.yml file for running unit tests in GitHub actions
Automatically completes the test (2), and yaml files (4)
Automatically adds the learner package to the DESCRIPTION file
For the learner file all fields are automatically filled but methods must be manually added along with the parameter set, this is clearly marked up in the files.
To create a learner you must follow these steps:
Run this function with as many arguments as possible
Manually add .train
, .predict
private methods for the learner, as well as adding the
param_set
and possibly param_vals
. If properties include "oob_error"
and/or "importance"
then add these public methods manually.
Check the paramtests and unit tests pass locally.
Run
devtools::document(roclets = c('rd', 'collate', 'namespace'))
styler::style_pkg(style = styler::mlr_style)
(you may need to first run remotes::
)
lintr::lint_package()
Open a pull request to https://github.com/mlr-org/mlr3extralearners/pulls with the new learner template.