Functions
This page contains the documentation for all exported functions.
The Main Function
The main function bo!(problem::BossProblem; kwargs...) performs the Bayesian optimization. It augments the dataset (problem.data) and updates the model parameters and/or hyperparameters (problem.params) of the provided BossProblem.
The following diagram showcases the pipeline of the main function bo!.
![]() | ||||
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.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 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 bo! again for a new recommendation.
Important 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, ::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.update_parameters! — Functionupdate_parameters!(problem::BossProblem, params::ModelParams)Update the model parameters.
BOSS.augment_dataset! — Functionaugment_dataset!(::BossProblem, x::AbstractVector{<:Real}, y::AbstractVector{<:Real})
augment_dataset!(::BossProblem, X::AbstractMatrix{<:Real}, Y::AbstractMatrix{<:Real})Add one (as vectors) or more (as matrices) datapoints to the dataset.
BOSS.construct_acquisition — Functionconstruct_acquisition(::AcquisitionFunction, ::BossProblem, ::BossOptions) -> (x -> ::Real)Construct the given AcquisitionFunction for the given BossProblem.
The returned function acq(x::AbstractVector{<:Real}) = val::Real is maximized to select the next evaluation function of blackbox function in each iteration.
This method must be implemented for all subtypes of AcquisitionFunction.
BOSS.model_posterior — Functionmodel_posterior(::BossProblem) -> ::Union{<:ModelPosterior, <:AbstractVector{<:ModelPosterior}}
model_posterior(::SurrogateModel, ::ModelParams, ::ExperimentData) -> ::ModelPosterior
model_posterior(::SurrogateModel, ::AbstractVector{<:ModelParams}, ::ExperimentData) -> ::AbstractVector{<:ModelPosterior}Return an instance of ModelPosterior allowing to evaluate the posterior predictive distribution, or a vector of ModelPosteriors in case of multiple sampled model parameters.
See ModelPosterior for the list of available methods.
BOSS.model_posterior_slice — Functionmodel_posterior_slice(::BossProblem, slice::Int) -> ::Union{<:ModelPosteriorSlice, <:AbstractVector{<:ModelPosteriorSlice}}
model_posterior_slice(::SurrogateModel, ::ModelParams, ::ExperimentData, slice::Int) -> ::ModelPosteriorSlice
model_posterior_slice(::SurrogateModel, ::AbstractVector{<:ModelParams}, ::ExperimentData, slice::Int) -> ::AbstractVector{<:ModelPosteriorSlice}Return an instance of ModelPosteriorSlice allowing to evaluate the posterior predictive distribution, or a vector of ModelPosteriorSlices in case of multiple sampled model parameters.
See ModelPosteriorSlice for the list of available methods.
Utility Functions
BOSS.x_dim — Functionx_dim(::BossProblem) -> IntReturn the input dimension of the problem.
BOSS.y_dim — Functiony_dim(::BossProblem) -> IntReturn the output dimension of the problem.
BOSS.cons_dim — Functioncons_dim(::BossProblem) -> Int
cons_dim(::Domain) -> IntReturn the output dimension of the constraint function on the input.
See Domain for more information.
BOSS.data_count — Functiondata_count(::BossProblem) -> IntReturn the number of datapoints in the dataset.
BOSS.is_consistent — Functionis_consistent(::BossProblem) -> BoolReturn true iff the model parameters have been fitted using the current dataset.
BOSS.get_fitness — Functionget_fitness(::AcquisitionFunction) -> (y -> ::Real)Return the fitness function if the given AcquisitionFunction defines it. Otherwise, throw MethodError.
BOSS.get_params — Functionget_params(::BossProblem) -> ::Union{::ModelParams, AbstractVector{<:ModelParams}}
get_params(::UniFittedParams) -> ::ModelParams
get_params(::MultiFittedParams) -> ::AbstractVector{<:ModelParams}Return the fitted ModelParams or a vector of ModelParams samples.
BOSS.result — Functionresult(problem) -> (x, y)Return the best found point (x, y).
The provided BossProblem must contain an AcquisitionFunction, with the get_fitness function defined.
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.
BOSS.calc_inverse_gamma — FunctionReturn an Inverse Gamma distribution with approximately 0.99 probability mass between lb and ub.
BOSS.TruncatedMvNormal — TypeTruncatedMvNormal(μ, Σ, lb, ub)Defines the truncated multivariate normal distribution with mean μ, covariance matrix Σ, lower bounds lb, and upper bounds ub.
