makeHyperoptWrapper: Fuse learner with mlrHyperopt tuning.

Description Usage Arguments Value Examples

View source: R/HyperoptWrapper.R

Description

Fuses an mlr base learner with mlrHyperopt tuning. Creates a learner object, which can be used like any other learner object. If the train function is called on it, hyperopt is invoked to select an optimal set of hyperparameter values. Finally, a model is fitted on the complete training data with these optimal hyperparameters and returned.

Usage

1
2
3
4
5
6
makeHyperoptWrapper(
  learner,
  par.config = NULL,
  hyper.control = NULL,
  show.info = getMlrOptions()$show.info
)

Arguments

learner

[Learner] Learner

par.config

[ParConfig] The Parameter Configuration

hyper.control

[HyperControl] The Hyperparameter Control Object

show.info

[logical(1)]
Print verbose output on console? Default is set via configureMlr.

Value

[Learner].

Examples

1
2
3
4
5
6
7
8
9
task = makeClassifTask(data = iris, target = "Species")
lrn = makeLearner("classif.svm")
lrn = makeHyperoptWrapper(lrn)
mod = train(lrn, task)
print(getTuneResult(mod))
# nested resampling for evaluation
# we also extract tuned hyper pars in each iteration
r = resample(lrn, task, cv3, extract = getTuneResult)
getNestedTuneResultsX(r)

jakob-r/mlrHyperopt documentation built on Jan. 10, 2022, 4:32 p.m.