Tuner: Tuner

Description Private Methods Technical Details and Subclasses Active bindings Methods Examples

Description

Abstract Tuner class that implements the base functionality each tuner must provide. A tuner is an object that describes the tuning strategy, i.e. how to optimize the black-box function and its feasible set defined by the TuningInstanceSingleCrit / TuningInstanceMultiCrit object.

A tuner must write its result into the TuningInstanceSingleCrit / TuningInstanceMultiCrit using the assign_result method of the bbotk::OptimInstance at the end of its tuning in order to store the best selected hyperparameter configuration and its estimated performance vector.

Private Methods

Technical Details and Subclasses

A subclass is implemented in the following way:

Active bindings

param_set

(paradox::ParamSet).

param_classes

(character()).

properties

(character()).

packages

(character()).

Methods

Public methods


Method new()

Creates a new instance of this R6 class.

Usage
Tuner$new(param_set, param_classes, properties, packages = character())
Arguments
param_set

(paradox::ParamSet)
Set of control parameters for tuner.

param_classes

(character())
Supported parameter classes for learner hyperparameters that the tuner can optimize, subclasses of paradox::Param.

properties

(character())
Set of properties of the tuner. Must be a subset of mlr_reflections$tuner_properties.

packages

(character())
Set of required packages. Note that these packages will be loaded via requireNamespace(), and are not attached.


Method format()

Helper for print outputs.

Usage
Tuner$format()

Method print()

Print method.

Usage
Tuner$print()
Returns

(character()).


Method optimize()

Performs the tuning on a TuningInstanceSingleCrit or TuningInstanceMultiCrit until termination. The single evaluations will be written into the ArchiveTuning that resides in the TuningInstanceSingleCrit/TuningInstanceMultiCrit. The result will be written into the instance object.

Usage
Tuner$optimize(inst)
Arguments
inst

(TuningInstanceSingleCrit | TuningInstanceMultiCrit).

Returns

data.table::data.table


Method clone()

The objects of this class are cloneable with this method.

Usage
Tuner$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
instance = TuningInstanceSingleCrit$new(
  task = tsk("iris"),
  learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE)),
  resampling = rsmp("holdout"),
  measure = msr("classif.ce"),
  terminator = trm("evals", n_evals = 3)
)
tuner = tnr("random_search")

# optimize hyperparameter
# modifies the instance by reference
tuner$optimize(instance)

# returns best configuration and best performance
instance$result

# allows access of data.table of full path of all evaluations
instance$archive

mlr3tuning documentation built on Sept. 14, 2021, 9:08 a.m.