Functions
This page contains the documentation for all exported functions.
Main Function
The main function bo!(::BossProblem; kwargs...)
performs the Bayesian optimization. It augments the dataset and updates the model parameters and/or hyperparameters stored in problem.data
.
BOSS.bo!
— Functionbo!(problem::BossProblem{Function}; kwargs...)
x = bo!(problem::BossProblem{Missing}; kwargs...)
Run the Bayesian optimization procedure to solve the given optimization problem or give a recommendation for the next evaluation point if problem.f == missing
.
Arguments
problem::BossProblem
: Defines the optimization problem.
Keywords
model_fitter::ModelFitter
: Defines the algorithm used to estimate model parameters.acq_maximizer::AcquisitionMaximizer
: Defines the algorithm used to maximize the acquisition function.acquisition::AcquisitionFunction
: Defines the acquisition function maximized to select promising candidates for further evaluation.term_cond::TermCond
: Defines the termination condition.options::BossOptions
: Defines miscellaneous settings.
References
BossProblem
, ModelFitter
, AcquisitionMaximizer
, TermCond
, BossOptions
Examples
See 'https://soldasim.github.io/BOSS.jl/stable/example/' for example usage.
The following diagram showcases the pipeline of the main function. The package can be used in two modes;
The "BO mode" is used if the objective function is defined within the BossProblem
. In this mode, BOSS performs the standard Bayesian optimization procedure while querying the objective function for new points.
The "Recommender mode" is used if the objective function is missing
. In this mode, BOSS performs a single iteration of the Bayesian optimization procedure and returns a recommendation for the next evaluation point. The user can evaluate the objective function manually, use the method augment_dataset!
to add the result to the data, and call BOSS again for a new recommendation.
![]() | ||||
Utility Functions
BOSS.estimate_parameters!
— Functionestimate_parameters!(::BossProblem, ::ModelFitter)
Estimate the model parameters & hyperparameters using the given model_fitter
algorithm.
Keywords
options::BossOptions
: Defines miscellaneous settings.
BOSS.maximize_acquisition
— Functionx = maximize_acquisition(::BossProblem, ::AcquisitionFunction, ::AcquisitionMaximizer)
Maximize the given acquisition
function via the given acq_maximizer
algorithm to find the optimal next evaluation point(s).
Keywords
options::BossOptions
: Defines miscellaneous settings.
BOSS.eval_objective!
— Functioneval_objective!(::BossProblem, x::AbstractVector{<:Real})
Evaluate the objective function and update the data.
Keywords
options::BossOptions
: Defines miscellaneous settings.
BOSS.augment_dataset!
— Functionaugment_dataset!(data::ExperimentDataPost, x::AbstractVector{<:Real}, y::AbstractVector{<:Real})
augment_dataset!(data::ExperimentDataPost, X::AbstractMatrix{<:Real}, Y::AbstractMatrix{<:Real})
Add one (as vectors) or more (as matrices) datapoints to the dataset.
BOSS.model_posterior
— Functionmodel_posterior(::BossProblem) -> post
Return the posterior predictive distribution of the surrogate model with two methods:
post(x::AbstractVector{<:Real}) -> μs::AbstractVector{<:Real}, σs::AsbtractVector{<:Real}
post(X::AbstractMatrix{<:Real}) -> μs::AbstractMatrix{<:Real}, Σs::AbstractArray{<:Real, 3}
The first method takes a single point x
of length x_dim(::BossProblem)
from the Domain
, and returns the predictive means and deviations of the corresponding output vector y
of length y_dim(::BossProblem)
such that:
μs, σs = post(x)
=>y ∼ product_distribution(Normal.(μs, σs))
μs, σs = post(x)
=>y[i] ∼ Normal(μs[i], σs[i])
The second method takes multiple points from the Domain
as a column-wise matrix X
of size (x_dim, N)
, and returns the joint predictive means and covariance matrices of the corresponding output matrix Y
of size (y_dim, N)
such that:
μs, Σs = post(X)
=>transpose(Y) ∼ product_distribution(MvNormal.(eachcol(μs), eachslice(Σs; dims=3)))
μs, Σs = post(X)
=>Y[i,:] ∼ MvNormal(μs[:,i], Σs[:,:,i])
See also: model_posterior_slice
BOSS.model_posterior_slice
— Functionmodel_posterior_slice(::BossProblem, slice::Int) -> post
Return the posterior predictive distributions of the given output slice
with two methods:
post(x::AbstractVector{<:Real}) -> μ::Real, σ::Real
post(X::AbstractMatrix{<:Real}) -> μ::AbstractVector{<:Real}, Σ::AbstractMatrix{<:Real}
The first method takes a single point x
of length x_dim(::BossProblem)
from the Domain
, and returns the predictive mean and deviation of the corresponding output number y
such that:
μ, σ = post(x)
=>y ∼ Normal(μ, σ)
The second method takes multiple points from the Domain as a column-wise matrix
Xof size
(x_dim, N), and returns the joint predictive mean and covariance matrix of the corresponding output vector
yof length
N` such that:
μ, Σ = post(X)
=>y ∼ MvNormal(μ, Σ)
In case one is only interested in predicting a certain output dimension, using model_posterior_slice
can be more efficient than model_posterior
(depending on the used SurrogateModel
).
Note that model_posterior_slice
can be used even if sliceable(model) == false
. It will, however, not provide any additional efficiency in such case.
See also: model_posterior
BOSS.average_posterior
— FunctionReturn an averaged posterior predictive distribution of the given posteriors.
The posterior is a function predict(x) -> (mean, std)
which gives the mean and standard deviation of the predictive distribution as a function of x
.
BOSS.result
— Functionresult(problem) -> (x, y)
Return the best found point (x, y)
.
Returns the point (x, y)
from the dataset of the given problem such that y
satisfies the constraints and fitness(y)
is maximized. Returns nothing if the dataset is empty or if no feasible point is present.
Does not check whether x
belongs to the domain as no exterior points should be present in the dataset.