library(mlrMBO) library(rgenoud) set.seed(1) knitr::opts_chunk$set(cache = TRUE, collapse = FALSE) knitr::knit_hooks$set(document = function(x){ gsub("```\n*```r*\n*", "", x) })
This vignette gives a short example of the usage of the adaptive infill criteria in mlrMBO
.
An adaptive infill criterion can change its behaviour based on the progress of the optimization. The progress has to be supplied by the termination criterion. All integrated termination criteria support this feature.
To specify which infill criterion should be used, the MBOControl
object has to be extended by calling setMBOControlInfill()
.
In addition to the criterion you can also set the parameters of the infill criterion optimization.
The criterion itself is created with makeMBOInfillCrit*()
.
The most common infill criteria are predefined like crit.ei
and crit.cb2
. See ?MBOInfillCrit
for details.
ctrl = makeMBOControl() ctrl = setMBOControlTermination(ctrl, iters = 10L) ctrl = setMBOControlInfill(ctrl, crit = makeMBOInfillCritAdaCB(cb.lambda.start = 4, cb.lambda.end = 0.1))
This will lead to an CB infill criterion ($CB(x) = \hat{\mu}(x) \pm \lambda * \hat{s}(x)$) that will focus on uncertain regions in the beginning (cb.lambda.start = 4
) and towards the end will have a stronger focus on areas close to the global minimum of the surrogate (cb.lambda.end = 0.1
).
test.fun = makeSingleObjectiveFunction( fn = function(x) x[1]^2 * sin(3 * x[2]), par.set = makeNumericParamSet(lower = 0, upper = 1, len = 2L) )
You can now start the optimization like usual:
res = mbo(test.fun, control = ctrl)
If we look at the OptPath we can see the different progress values and the resulting different values of lambda.
tail(as.data.frame(res$opt.path))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.