lts: Syntactic Sugar for Tuning Space Construction

View source: R/sugar.R

ltsR Documentation

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 class 'missing'
lts(x, ...)

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

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

ltss(x)

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).

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

Examples

# 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"))

mlr3tuningspaces documentation built on April 20, 2023, 5:07 p.m.