TuningSpace | R Documentation |
This class defines a tuning space for hyperparameter tuning.
For tuning, it is important to create a search space that defines the range over which hyperparameters should be tuned.
TuningSpace
object consists of search spaces from peer-reviewed articles which work well for a wide range of data sets.
The $values
field stores a list of paradox::TuneToken which define the search space.
These tokens can be assigned to the $values
slot of a learner's paradox::ParamSet.
When the learner is tuned, the tokens are used to create the search space.
as.data.table.TuningSpace(x)
Returns a tabular view of the tuning space.
TuningSpace -> data.table::data.table()
x
(TuningSpace)
id
(character(1)
)
Identifier of the object.
values
(list()
)
List of paradox::TuneToken that describe the tuning space and fixed parameter values.
tags
(character()
)
Arbitrary tags to group and filter tuning space e.g. "classification"
or "regression
".
learner
(character(1)
)
mlr3::Learner of the tuning space.
package
(character(1)
)
Packages which provide the mlr3::Learner, e.g. mlr3learners for the learner
mlr3learners::LearnerClassifRanger which interfaces the ranger package.
label
(character(1)
)
Label for this object.
Can be used in tables, plot and text output instead of the ID.
man
(character(1)
)
String in the format [pkg]::[topic]
pointing to a manual page for this object.
The referenced help package can be opened via method $help()
.
new()
Creates a new instance of this R6 class.
TuningSpace$new( id, values, tags, learner, package = character(), label = NA_character_, man = NA_character_ )
id
(character(1)
)
Identifier for the new instance.
values
(list()
)
List of paradox::TuneToken that describe the tuning space and fixed parameter values.
tags
(character()
)
Tags to group and filter tuning spaces e.g. "classification"
or "regression
".
learner
(character(1)
)
mlr3::Learner of the tuning space.
package
(character()
)
Packages which provide the mlr3::Learner, e.g. mlr3learners for the learner
mlr3learners::LearnerClassifRanger which interfaces the ranger package.
label
(character(1)
)
Label for the new instance.
Can be used in tables, plot and text output instead of the ID.
man
(character(1)
)
String in the format [pkg]::[topic]
pointing to a manual page for for the new instance.
The referenced help package can be opened via method $help()
.
get_learner()
Returns a learner with paradox::TuneToken set in parameter set.
TuningSpace$get_learner(...)
...
(named ‘list()’)
Passed to mlr3::lrn()
. Named arguments passed to the constructor, to
be set as parameters in the paradox::ParamSet, or to be set as public
field. See mlr3misc::dictionary_sugar_get()
for more details.
mlr3::Learner
format()
Helper for print outputs.
TuningSpace$format(...)
...
(ignored).
help()
Opens the corresponding help page referenced by field $man
.
TuningSpace$help()
print()
Printer.
TuningSpace$print(...)
...
(ignored).
clone()
The objects of this class are cloneable with this method.
TuningSpace$clone(deep = FALSE)
deep
Whether to make a deep clone.
library(mlr3tuning)
# Get default tuning space of rpart learner
tuning_space = lts("classif.rpart.default")
# Set tuning space
learner = lrn("classif.rpart")
learner$param_set$values = tuning_space$values
# Tune learner
instance = tune(
tnr("random_search"),
task = tsk("pima"),
learner = learner,
resampling = rsmp ("holdout"),
measure = msr("classif.ce"),
term_evals = 10)
instance$result
library(mlr3pipelines)
# Set tuning space in a pipeline
graph_learner = as_learner(po("subsample") %>>%
lts(lrn("classif.rpart")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.