Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
42c0230
push latest so_config attic
sumny Jun 7, 2022
a52d4fc
new so_config
sumny Jul 5, 2022
9aeeb08
fix: always add dropped columns to xdt during surrogate predict
sumny Jul 6, 2022
483b643
new so_config
sumny Jul 6, 2022
c91acc6
Merge remote-tracking branch 'origin/main' into so_config
sumny Jul 6, 2022
86e3c3f
use current bbotk main branch
sumny Jul 6, 2022
9dac619
LearnerRegrRangerCustom
sumny Aug 25, 2022
c360b4a
yahpo experiments
sumny Aug 25, 2022
936d287
fix init_design_size for random_interleave, acqopt logging and warmstart
sumny Aug 29, 2022
fefeb38
tweaks in acq opt and warmstart
sumny Aug 29, 2022
62bb10a
some more infill optimization tweaks for so config
sumny Aug 30, 2022
31022b4
..
sumny Aug 30, 2022
0105890
new ac setup
sumny Sep 2, 2022
630a330
..
sumny Sep 2, 2022
3dbe05a
..
sumny Sep 5, 2022
0fac55d
..
sumny Sep 6, 2022
93a438c
..
sumny Sep 7, 2022
0bb4b98
..
sumny Sep 7, 2022
44ba83d
..
sumny Sep 7, 2022
0f221a4
..
sumny Sep 9, 2022
6e1b093
..
sumny Sep 9, 2022
8ca0093
..
sumny Sep 9, 2022
9cfb3e1
play around with log scaling
sumny Oct 4, 2022
20930c5
Merge remote-tracking branch 'origin/main' into so_config
sumny Nov 23, 2022
73f216b
chore: AcqFunctionCB cleanup
sumny Nov 23, 2022
538d384
merge acqf_ttei from acqf_ttei branch for now
sumny Nov 23, 2022
9ecc7a7
..
sumny Nov 23, 2022
5e11422
prepare new so_config
sumny Nov 23, 2022
032a682
..
sumny Nov 23, 2022
1b165b0
new cd version
sumny Nov 27, 2022
d0df4f5
some so config try-outs
sumny Nov 30, 2022
03b71af
mies baseline
sumny Dec 1, 2022
6860abc
new eval scheme for so_config
sumny Dec 23, 2022
3842d29
..
sumny Dec 23, 2022
f141a09
..
sumny Jan 2, 2023
9cb4f7e
Merge remote-tracking branch 'origin/main' into so_config
sumny Jan 3, 2023
9c983e8
..
sumny Jan 8, 2023
5590bb5
..
sumny Jan 16, 2023
61287cc
..
sumny Jan 17, 2023
7c2a3b3
..
sumny Jan 17, 2023
748ec16
..
sumny Jan 18, 2023
e9242af
..
sumny Jan 19, 2023
ad412aa
some changes to char to fct handling, ...
sumny Jan 20, 2023
bc1acc6
Merge remote-tracking branch 'origin/main' into so_config, add fs bas…
sumny Jan 20, 2023
42f318c
..
sumny Jan 21, 2023
a961d0c
...
sumny Jan 23, 2023
11860b9
..
sumny Jan 24, 2023
c0d5c73
..
sumny Jan 26, 2023
4d3f68b
add learner
pfistfl Feb 1, 2023
02af565
fix impl errors, add docs
pfistfl Feb 1, 2023
774cd43
update
pfistfl Feb 3, 2023
2357850
add to dict?
pfistfl Feb 3, 2023
9107070
..
sumny Feb 13, 2023
f218465
reiterate lfbo
sumny Feb 15, 2023
461a2b7
Merge remote-tracking branch 'origin/main' into likelihood_free
sumny Feb 15, 2023
564d0d7
rerun docs
sumny Feb 15, 2023
e09470b
Merge remote-tracking branch 'origin/main' into so_config
sumny Feb 15, 2023
53a7df3
Merge remote-tracking branch 'origin/likelihood_free' into so_config
sumny Feb 15, 2023
3e746e7
..
sumny Feb 15, 2023
7332fba
manually require setting the lfbo direction
sumny Feb 15, 2023
9fee32a
Merge remote-tracking branch 'origin/likelihood_free' into so_config
sumny Feb 15, 2023
967ab12
..
sumny Feb 15, 2023
4ac01d4
..
sumny Feb 18, 2023
2d54d0b
..
sumny Feb 22, 2023
dda812a
..
sumny Mar 2, 2023
11c4e57
..
sumny Mar 2, 2023
17700ac
..
sumny Mar 2, 2023
b4ecd66
fix: fix_xdt_missing for logical NA
sumny Mar 14, 2023
40cacad
Merge remote-tracking branch 'origin/main' into so_config
sumny Mar 31, 2024
6023eaf
..
sumny Apr 1, 2024
171dcce
..
sumny Apr 1, 2024
306138c
fix: remove reqired from parameters with default
be-marc May 29, 2024
55b0cd8
Merge branch 'main' into so_config_2
be-marc Jun 27, 2024
9aa887f
fix: bbotk update
be-marc Jun 27, 2024
7cb1fa5
fix: optimizerchain
be-marc Jun 28, 2024
6a99e1f
update
be-marc Jun 29, 2024
5578435
refactor: local search with new paradox
be-marc Jun 29, 2024
aad068e
fix: cols_y
be-marc Jul 2, 2024
c66ed0f
Merge branch 'main' into so_config_2
be-marc Jul 2, 2024
30a3546
fix: remove browser()
be-marc Jul 2, 2024
5ba9ea7
chore: browser
be-marc Jul 2, 2024
77cb3fe
fix: local search
be-marc Jul 2, 2024
9bbc698
fix: minimize
be-marc Jul 8, 2024
ae87021
refactor: remove chain and local search
be-marc Aug 13, 2024
a32b631
Merge branch 'main' into so_config_2
be-marc Aug 13, 2024
d858ea2
feat: add epsilon to log ei
be-marc Aug 13, 2024
c5a3670
..
sumny Aug 13, 2024
d57e6ae
feat: rework LearnerRegrRangerMbo
sumny Aug 17, 2024
ca03059
..
sumny Aug 17, 2024
c572a14
fix: make log ei more robost
be-marc Aug 26, 2024
9af8c19
Merge remote-tracking branch 'origin/main' into so_config_2
sumny Sep 2, 2024
58f1e3a
se >= 1e-8 for LearnerRegrRangerMbo and law of total variance
sumny Sep 2, 2024
f44a741
..
sumny Sep 2, 2024
ce2e16f
perf: speed up surrogate predictions
sumny Nov 19, 2024
9992c66
draft SurrogateGP
sumny Nov 19, 2024
bef4ebb
typo
sumny Nov 19, 2024
91b8751
Merge remote-tracking branch 'origin/main' into so_config_2
sumny Apr 21, 2025
2a2f574
..
sumny Apr 21, 2025
8b65c38
Merge remote-tracking branch 'origin/main' into surrogate_speedup
sumny May 16, 2025
605a305
..
sumny May 16, 2025
a4ffa71
Merge remote-tracking branch 'origin/main' into surrogate_speedup
sumny May 16, 2025
1736838
Merge remote-tracking branch 'origin/main' into so_config_3
sumny May 26, 2025
b995789
Merge remote-tracking branch 'origin/main' into so_config_3
sumny May 26, 2025
5814634
..
sumny May 27, 2025
53925b8
..
sumny Jun 12, 2025
a9961c1
...
be-marc Jul 7, 2025
e8e28dd
...
be-marc Jul 8, 2025
e7ae13b
...
be-marc Jul 8, 2025
64490d6
...
be-marc Jul 8, 2025
358c150
...
be-marc Jul 8, 2025
1674a5b
...
be-marc Jul 8, 2025
dd401b9
Merge branch 'main' into so_config_5
be-marc Jul 8, 2025
ecdc1d2
...
be-marc Jul 8, 2025
766bb85
Merge branch 'surrogate_speedup' into so_config_5
be-marc Jul 9, 2025
375a68e
...
be-marc Jul 10, 2025
b945e2b
...
be-marc Jul 11, 2025
2edf8d1
...
be-marc Jul 11, 2025
4feda55
...
be-marc Jul 11, 2025
1745450
...
be-marc Jul 16, 2025
df421cd
...
be-marc Aug 5, 2025
0d7ad58
...
be-marc Aug 5, 2025
24d538d
...
be-marc Aug 6, 2025
b4ceab2
...
be-marc Aug 6, 2025
b3e38df
...
be-marc Aug 6, 2025
c0d689b
...
be-marc Aug 6, 2025
46eb09f
...
be-marc Aug 6, 2025
56744d2
...
be-marc Aug 6, 2025
51ccaf3
...
be-marc Aug 6, 2025
d9d665f
...
be-marc Aug 8, 2025
b008098
...
be-marc Aug 8, 2025
d49a80a
add libcmaesr
be-marc Sep 15, 2025
8386a48
...
be-marc Sep 15, 2025
4bf295e
...
be-marc Sep 15, 2025
be65653
...
be-marc Sep 25, 2025
ab400d1
...
be-marc Sep 26, 2025
9656e5b
...
be-marc Sep 28, 2025
f60b5d5
...
be-marc Sep 28, 2025
f89c7ff
...
be-marc Sep 29, 2025
fe910e1
...
be-marc Sep 29, 2025
d71f0f2
...
be-marc Sep 29, 2025
083e381
...
be-marc Oct 2, 2025
915adca
Merge branch 'main' into so_config_6
be-marc Oct 8, 2025
178b64a
...
be-marc Oct 10, 2025
ef29af7
...
be-marc Oct 16, 2025
dfe2c9f
...
be-marc Oct 17, 2025
6a6832f
...
be-marc Oct 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ linters: linters_with_defaults(
object_name_linter = object_name_linter(c("snake_case", "CamelCase")), # only allow snake case and camel case object names
cyclocomp_linter = NULL, # do not check function complexity
commented_code_linter = NULL, # allow code in comments
line_length_linter = line_length_linter(120),
line_length_linter = line_length_linter(200),
indentation_linter(indent = 2L, hanging_indent_style = "never")
)
21 changes: 17 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: mlr3mbo
Title: Flexible Bayesian Optimization
Version: 0.3.2.9000
Version: 0.3.0.9003
Authors@R: c(
person("Marc", "Becker", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-8115-0400")),
Expand Down Expand Up @@ -39,6 +39,7 @@ License: LGPL-3
URL: https://mlr3mbo.mlr-org.com, https://github.com/mlr-org/mlr3mbo
BugReports: https://github.com/mlr-org/mlr3mbo/issues
Depends:
mlr3 (>= 1.2.0),
mlr3tuning (>= 1.4.0),
R (>= 3.1.0)
Imports:
Expand All @@ -56,8 +57,9 @@ Suggests:
emoa,
fastGHQuad,
lhs,
libcmaesr,
mlr3learners (>= 0.12.0),
mirai,
mlr3learners (>= 0.7.0),
mlr3pipelines (>= 0.5.2),
nloptr,
ranger,
Expand All @@ -66,14 +68,17 @@ Suggests:
redux,
rush,
stringi,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
Remotes:
mlr-org/bbotk,
mlr-org/libcmaesr
ByteCompile: no
Encoding: UTF-8
Config/testthat/edition: 3
Config/testthat/parallel: false
NeedsCompilation: yes
Roxygen: list(markdown = TRUE, r6 = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Collate:
'mlr_acqfunctions.R'
'AcqFunction.R'
Expand All @@ -92,10 +97,16 @@ Collate:
'AcqFunctionStochasticCB.R'
'AcqFunctionStochasticEI.R'
'AcqOptimizer.R'
'AcqOptimizerCmaes.R'
'AcqOptimizerDirect.R'
'AcqOptimizerLbfgsb.R'
'AcqOptimizerLocalSearch.R'
'AcqOptimzerRandomSearch.R'
'mlr_input_trafos.R'
'InputTrafo.R'
'InputTrafoUnitcube.R'
'aaa.R'
'LearnerRegrRangerMbo.R'
'OptimizerADBO.R'
'OptimizerAsyncMbo.R'
'OptimizerMbo.R'
Expand All @@ -108,8 +119,10 @@ Collate:
'ResultAssignerArchive.R'
'ResultAssignerSurrogate.R'
'Surrogate.R'
'SurrogateGP.R'
'SurrogateLearner.R'
'SurrogateLearnerCollection.R'
'SurrogateRF.R'
'TunerADBO.R'
'TunerAsyncMbo.R'
'TunerMbo.R'
Expand Down
9 changes: 9 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ S3method(as.data.table,DictionaryInputTrafo)
S3method(as.data.table,DictionaryLoopFunction)
S3method(as.data.table,DictionaryOutputTrafo)
S3method(as.data.table,DictionaryResultAssigner)
S3method(default_values,LearnerRegrRangerMbo)
S3method(print,loop_function)
export(AcqFunction)
export(AcqFunctionAEI)
Expand All @@ -22,8 +23,14 @@ export(AcqFunctionSmsEgo)
export(AcqFunctionStochasticCB)
export(AcqFunctionStochasticEI)
export(AcqOptimizer)
export(AcqOptimizerCmaes)
export(AcqOptimizerDirect)
export(AcqOptimizerLbfgsb)
export(AcqOptimizerLocalSearch)
export(AcqOptimizerRandomSearch)
export(InputTrafo)
export(InputTrafoUnitcube)
export(LearnerRegrRangerMbo)
export(OptimizerADBO)
export(OptimizerAsyncMbo)
export(OptimizerMbo)
Expand All @@ -34,8 +41,10 @@ export(ResultAssigner)
export(ResultAssignerArchive)
export(ResultAssignerSurrogate)
export(Surrogate)
export(SurrogateGP)
export(SurrogateLearner)
export(SurrogateLearnerCollection)
export(SurrogateRF)
export(TunerADBO)
export(TunerAsyncMbo)
export(TunerMbo)
Expand Down
142 changes: 142 additions & 0 deletions R/AcqOptimizerCmaes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#' @title CMA-ES Acquisition Function Optimizer
#'
#' @include AcqOptimizer.R
#'
#' @description
#' CMA-ES acquisition function optimizer.
#' Calls `cmaes()` from \CRANpkg{libcmaesr}.
#' The default algorithm is `"abipop"` with unlimited restarts and a budget of `100 * D^2` function evaluations, where `D` is the dimension of the search space.
#' For the meaning of the control parameters, see `libcmaesr::cmaes_control()`.
#'
#' @section Termination Parameters:
#' The following termination parameters can be used.
#'
#' \describe{
#' \item{`max_fevals`}{`integer(1)`\cr
#' Maximum number of function evaluations.
#' Deactivate with `NA`.
#' Default is `100 * D^2`, where `D` is the dimension of the search space.}
#' \item{`max_iter`}{`integer(1)`\cr
#' Maximum number of iterations.
#' Deactivate with `NA`.}
#' \item{`ftarget`}{`numeric(1)`\cr
#' Target function value.
#' Deactivate with `NA`.}
#' \item{`f_tolerance`}{`numeric(1)`\cr
#' Function tolerance.
#' Deactivate with `NA`.}
#' \item{`x_tolerance`}{`numeric(1)`\cr
#' Parameter tolerance.
#' Deactivate with `NA`.}
#' }
#'
#' @export
AcqOptimizerCmaes = R6Class("AcqOptimizerCmaes",
inherit = AcqOptimizer,
public = list(

#' @description
#' Creates a new instance of this [R6][R6::R6Class] class.
#'
#' @param acq_function (`NULL` | [AcqFunction]).
initialize = function(acq_function = NULL) {
self$acq_function = assert_r6(acq_function, "AcqFunction", null.ok = TRUE)
param_set = ps(
algo = p_fct(init = "abipop", levels = c(
"cmaes",
"ipop",
"bipop",
"acmaes",
"aipop",
"abipop",
"sepcmaes",
"sepipop",
"sepbipop",
"sepacmaes",
"sepaipop",
"sepabipop",
"vdcma",
"vdipopcma",
"vdbipopcma")),
lambda = p_int(lower = 1L, default = NA_integer_, special_vals = list(NA_integer_)),
sigma = p_dbl(default = NA_real_, special_vals = list(NA_real_)),
max_restarts = p_int(lower = 1L, special_vals = list(NA), init = 1e5L),
tpa = p_int(default = NA_integer_, special_vals = list(NA_integer_)),
tpa_dsigma = p_dbl(default = NA_real_, special_vals = list(NA_real_)),
seed = p_int(default = NA_integer_, special_vals = list(NA_integer_)),
quiet = p_lgl(default = FALSE),
# internal termination criteria
max_fevals = p_int(lower = 1L, special_vals = list(NA_integer_)),
max_iter = p_int(lower = 1L, default = NA_integer_, special_vals = list(NA_integer_)),
ftarget = p_dbl(default = NA_real_, special_vals = list(NA_real_)),
f_tolerance = p_dbl(default = NA_real_, special_vals = list(NA_real_)),
x_tolerance = p_dbl(default = NA_real_, special_vals = list(NA_real_)),
catch_errors = p_lgl(init = TRUE)
)
private$.param_set = param_set
},

#' @description
#' Optimize the acquisition function.
#'
#' @return [data.table::data.table()] with 1 row per candidate.
optimize = function() {
pv = self$param_set$values

if (is.null(pv$max_fevals)) {
pv$max_fevals = 100 * self$acq_function$domain$length^2
}

fun = get_private(self$acq_function)$.fun
constants = self$acq_function$constants$values
direction = self$acq_function$codomain$direction

control = invoke(libcmaesr::cmaes_control, maximize = direction == -1L, .args = pv[names(pv) %in% formalArgs(libcmaesr::cmaes_control)])

wrapper = function(xmat) {
xdt = set_names(as.data.table(xmat), self$acq_function$domain$ids())
mlr3misc::invoke(fun, xdt = xdt, .args = constants)[[1]]
}

lower = self$acq_function$domain$lower
upper = self$acq_function$domain$upper
x0 = as.numeric(self$acq_function$archive$best()[, self$acq_function$domain$ids(), with = FALSE])

# add saveguard_epsilon to x0
saveguard_epsilon = 1e-5
x0[x0 < lower] = x0[x0 < lower] + saveguard_epsilon
x0[x0 > upper] = x0[x0 > upper] - saveguard_epsilon

optimize = function() {
libcmaesr::cmaes(
objective = wrapper,
x0 = x0,
lower = lower,
upper = upper,
batch = TRUE,
control = control)
}

if (pv$catch_errors) {
tryCatch({
res = optimize()
}, error = function(error_condition) {
lg$warn(error_condition$message)
stop(set_class(list(message = error_condition$message, call = NULL), classes = c("acq_optimizer_error", "mbo_error", "error", "condition")))
})
} else {
res = optimize()
}
as.data.table(as.list(set_names(c(res$x, res$y * direction), c(self$acq_function$domain$ids(), self$acq_function$codomain$ids()))))
}
),

active = list(
#' @template field_print_id
print_id = function(rhs) {
assert_ro_binding(rhs)
"(OptimizerBatchCmaes)"
}
)
)

Loading