R/BOstopping.R
BOstopping.RdR interface to Python's GPopt.BOstopping. A Gaussian-Process-based
Bayesian optimizer with built-in early stopping diagnostics (based on
e.g. Wasserstein-distance convergence of the posterior on a fixed test
set), useful when function evaluations are expensive and you want the
search to stop automatically once it has converged.
BOstopping(
f,
bounds,
n_init = 5L,
kappa = 1.96,
early_stopping = TRUE,
stop_patience = 20L,
stop_threshold = 0.01,
n_test_points = 100L,
alpha = 1e-06,
n_restarts_optimizer = 25L,
seed = 123L,
venv_path = "./venv"
)an R function taking a single numeric vector `x` (1-indexed, as usual in R) and returning a single numeric value to be minimized
a numeric matrix (or list of length-2 numeric vectors) with one row `c(lower, upper)` per dimension, e.g. `rbind(c(-5, 10), c(0, 15))`
number of points in the initial design
exploration/exploitation trade-off parameter for the acquisition function
logical, whether to enable early stopping
number of iterations without sufficient improvement before stopping
convergence threshold used by the early-stopping rule
number of points used to monitor convergence
numeric, GP regularization / noise parameter
number of restarts of the GP's internal hyperparameter optimizer
integer random seed
path to the Python virtual environment created with `uv` (see the package README for setup instructions)
A Python `GPopt.BOstopping` object, with `$optimize(n_iter = 100L)` as its main method (accessed with `$`).
if (FALSE) { # \dontrun{
branin <- function(x) {
x1 <- x[1]; x2 <- x[2]
term1 <- (x2 - (5.1 * x1^2) / (4 * pi^2) + (5 * x1) / pi - 6)^2
term2 <- 10 * (1 - 1 / (8 * pi)) * cos(x1)
term1 + term2 + 10
}
opt <- BOstopping(
f = branin,
bounds = rbind(c(-5, 10), c(0, 15)),
venv_path = "./venv"
)
result <- opt$optimize(n_iter = 100L)
} # }