Learn R Programming

mlr3tuningspaces (version 0.5.2)

lts: Syntactic Sugar for Tuning Space Construction

Description

Function to retrieve TuningSpace objects from mlr_tuning_spaces and further, allows a mlr3::Learner to be directly configured with a search space. This function belongs to mlr3::mlr_sugar family.

Usage

lts(x, ...)

# S3 method for missing lts(x, ...)

# S3 method for character lts(x, ...)

# S3 method for Learner lts(x, ...)

ltss(x)

Value

TuningSpace if x is character(). mlr3::Learner if x is mlr3::Learner. Or a list of objects for the ltss() function.

missing, mlr_tuning_spaces dictionary

a character, TuningSpace

a mlr3::Learner, mlr3::Learner with paradox::TuneToken

a list(), list of TuningSpace or mlr3::Learner

Arguments

x

(character() | mlr3::Learner)
If character, key passed the dictionary to retrieve the tuning space. If mlr3::Learner, default tuning space is added to the learner.

...

(named list of paradox::TuneToken | NULL)
Pass paradox::TuneToken to add or overwrite parameters in the tuning space. Use NULL to remove parameters (see examples).

Examples

Run this code
# load tuning space
lts("classif.rpart.default")

# load tuning space and add parameter
lts("classif.rpart.default", maxdepth = to_tune(1, 15))

# load tuning space and remove parameter
lts("classif.rpart.default", minsplit = NULL)

# load tuning space and overwrite parameter
lts("classif.rpart.default", minsplit = to_tune(32, 128))

# load learner and apply tuning space in one go
lts(lrn("classif.rpart"))

# load learner, overwrite parameter and apply tuning space
lts(lrn("classif.rpart"), minsplit = to_tune(32, 128))

# load multiple tuning spaces
ltss(c("classif.rpart.default", "classif.ranger.default"))

Run the code above in your browser using DataLab