tuneMboMbo: Tune SMBO hyperparameters by mlrMBO.

View source: R/tuneMboMbo.R

tuneMboMboR Documentation

Tune SMBO hyperparameters by mlrMBO.

Description

This function tunes the SMBO hyperparameters by mlrMBO. The user can choose if the tuning is initialized with an initial design or not. You can either pass one instance or multiple instances of the same problem as a list. We recommend to tune the hyperparameters after a large amount of black-box function evaluations, as the tuning will fail if the user chooses an amount which is too low. During the hyperparameter optimization of EBO::tuneMboMbo(), the user is able to see in the console if the hyperparameters can be tuned successfully. If all hyperparameter sets return approximately the same median of the target variable, we recommend to continue the SMBO with the default hyperparameters.

Usage

tuneMboMbo(
  instance,
  psOpt,
  funcEvals,
  psTune,
  itersMboTune = 10,
  minimize = FALSE,
  repls = 10,
  ncpus = NA,
  seed = 1,
  designOpt = NULL,
  maxTime = NULL
)

Arguments

instance

[list(1)]
A list containing the instance(s) as trained mlr learners.
You can either pass one or multiple instances of the same problem.

psOpt

[ParamHelpers::ParamSet()]
Parameter space for the optimization.

funcEvals

[integer(1)]
Define the amount of black-box function evaluations.

psTune

[ParamHelpers::ParamSet()]
The parameter space for the tuning.

itersMboTune

[integer(1)]
Define the amount of black-box function evaluations.
Default is ten.

minimize

[logical(1)]
Should the target be minimized?
Default is 'FALSE'.

repls

[integer(1)]
Define how often each configuration is replicated for the benchmark.
Default is ten.

ncpus

[numeric(1)]
Define how many cpu cores are used for the benchmark.
Default is NA, which uses all cores minus one.

seed

[numeric(1)]
Define the seed used for the computation. Will be set by batchtools. Which means the jobs get the seed plus the job.id as their unique seed.
Default is one.

designOpt

[data.frame(1)]
A data.frame containing the initial design for the optimization.

maxTime

[integer(1)]
This argument will overwrite itersMboTune and set a maximum time budget in seconds for the tuning.

Value

A data.frame containing the best suited hyperparameter set.

Examples

## Not run: 
set.seed(1)
data <- data.frame(a=runif(50,10,100),b=runif(50,40,750),d=runif(50,0,90))
data$ratio <- rowSums(data^2)
data$ratio <- data$ratio/max(data$ratio)
colnames(data) <- c("power","time","pressure","ratio")

model = list(mlr::train(mlr::makeLearner("regr.randomForest"),
             mlr::makeRegrTask(data = data, target = "ratio")))

psOpt = ParamHelpers::makeParamSet(
  ParamHelpers::makeNumericParam("power", lower = 10, upper = 100),
  ParamHelpers::makeNumericParam("time", lower = 40, upper = 750),
  ParamHelpers::makeNumericParam("pressure", lower = 0, upper = 90)
)

funcEvals = 10

psTune = ParamHelpers::makeParamSet(
  ParamHelpers::makeDiscreteParam("design", values = c("maximinLHS",
                                                       "optimumLHS")),

  ParamHelpers::makeDiscreteParam("crit", values = c("makeMBOInfillCritEI",
                                                     "makeMBOInfillCritAEI",
                                                     "makeMBOInfillCritCB",
                                                     "makeMBOInfillCritAdaCB")),

  ParamHelpers::makeDiscreteParam("surrogate", values = c("regr.randomForest",
                                                          "regr.km")),

  ParamHelpers::makeDiscreteParam("covtype" ,values = c("gauss","matern5_2",
                                                        "matern3_2","powexp"),
                                  requires = quote(surrogate == "regr.km"))
)

itersMboTune = 2

minimize = FALSE

repls = 2

resTune = tuneMboMbo(model, psOpt, funcEvals, psTune, itersMboTune, minimize, repls)

## End(Not run)

matthiasgruber/EBO documentation built on May 17, 2022, 3:19 p.m.