See mbo_parallel for all parallelization options.

mbo(
  fun,
  design = NULL,
  learner = NULL,
  control = NULL,
  show.info = getOption("mlrMBO.show.info", TRUE),
  more.args = list()
)

Arguments

fun

[smoof_function]
Fitness function to optimize. For one dimensional target functions you can obtain a smoof_function by using makeSingleObjectiveFunction. For multi dimensional functions use makeMultiObjectiveFunction. It is possible to return even more information which will be stored in the optimization path. To achieve this, simply append the attribute “extras” to the return value of the target function. This has to be a named list of scalar values. Each of these values will be stored additionally in the optimization path.

design

[data.frame]
Initial design as data frame. If the y-values are not already present in design, mbo will evaluate the points. If the parameters have corresponding trafo functions, the design must not be transformed before it is passed! Functions to generate designs are available in ParamHelpers: generateDesign, generateGridDesign, generateRandomDesign. Default is NULL, which means generateDesign is called and a design of size 4 times number of all parameters is created The points are drawn via maximinLHS to maximize the minimal distance between design points.

learner

[Learner]
Regression learner from mlr, which is used as a surrogate to model our fitness function. If NULL (default), the default learner is determined as described here: mbo_default_learner.

control

[MBOControl]
Control object for mbo.

show.info

[logical(1)]
Verbose output on console? Default is TRUE.

more.args

[list]
Further arguments passed to fitness function.

Examples

# simple 2d objective function
obj.fun = makeSingleObjectiveFunction(
 fn = function(x) x[1]^2 + sin(x[2]),
 par.set = makeNumericParamSet(id = "x", lower = -1, upper = 1, len = 2)
)

# create base control object
ctrl = makeMBOControl()

# do three MBO iterations
ctrl = setMBOControlTermination(ctrl, iters = 3L)

# use 500 points in the focussearch (should be sufficient for 2d)
ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 500)
# create initial design
des = generateDesign(n = 5L, getParamSet(obj.fun), fun = lhs::maximinLHS)

# start mbo
res = mbo(obj.fun, design = des, control = ctrl)
#> Computing y column(s) for design. Not provided.
#> [mbo] 0: x=0.0661,-0.481 : y = -0.458 : 0.0 secs : initdesign
#> [mbo] 0: x=0.223,0.279 : y = 0.326 : 0.0 secs : initdesign
#> [mbo] 0: x=0.626,0.0118 : y = 0.403 : 0.0 secs : initdesign
#> [mbo] 0: x=-0.634,-0.662 : y = -0.213 : 0.0 secs : initdesign
#> [mbo] 0: x=-0.435,0.695 : y = 0.83 : 0.0 secs : initdesign
#> [mbo] 1: x=0.0597,-0.386 : y = -0.373 : 0.0 secs : infill_cb
#> [mbo] 2: x=0.909,-0.525 : y = 0.325 : 0.0 secs : infill_cb
#> [mbo] 3: x=-0.0128,-1 : y = -0.841 : 0.0 secs : infill_cb

print(res)
#> Recommended parameters:
#> x=-0.0128,-1
#> Objective: y = -0.841
#> 
#> Optimization path
#> 5 + 3 entries in total, displaying last 10 (or less):
#>            x1          x2          y dob eol error.message exec.time         cb
#> 1  0.06613519 -0.48119103 -0.4584614   0  NA          <NA>         0         NA
#> 2  0.22345833  0.27926117  0.3255791   0  NA          <NA>         0         NA
#> 3  0.62554023  0.01175738  0.4030577   0  NA          <NA>         0         NA
#> 4 -0.63381850 -0.66243550 -0.2133132   0  NA          <NA>         0         NA
#> 5 -0.43459833  0.69542298  0.8295860   0  NA          <NA>         0         NA
#> 6  0.05969723 -0.38589206 -0.3728220   1  NA          <NA>         0 -0.6070689
#> 7  0.90907804 -0.52508228  0.3251387   2  NA          <NA>         0 -0.5559573
#> 8 -0.01277871 -0.99997692 -0.8412952   3  NA          <NA>         0 -0.8683917
#>   error.model train.time  prop.type propose.time        se       mean lambda
#> 1        <NA>         NA initdesign           NA        NA         NA     NA
#> 2        <NA>         NA initdesign           NA        NA         NA     NA
#> 3        <NA>         NA initdesign           NA        NA         NA     NA
#> 4        <NA>         NA initdesign           NA        NA         NA     NA
#> 5        <NA>         NA initdesign           NA        NA         NA     NA
#> 6        <NA>      0.096  infill_cb        0.264 0.2684078 -0.3386611      1
#> 7        <NA>      0.076  infill_cb        0.252 0.2052184 -0.3507389      1
#> 8        <NA>      0.078  infill_cb        0.243 0.1916187 -0.6767730      1
if (FALSE) {
plot(res)
}