Skip to main content

Reference

With BoTorch

A BoTorch Model, for BoTorch’s acquisition functions and optimizers.

LaplaceBoTorchSurrogate A Laplace-approximated neural network as a BoTorch model.

Training

What trains the network and fits the Laplace approximation, for both surrogates.

PosthocMarglik Train on the mean squared error, then tune the prior on the marginal likelihood.
OnlineMarglik Train with marginal-likelihood steps on the prior (Immer et al. 2021).
FSPLaplace Train under a GP prior over functions, then fit FSP-Laplace (Cinquin et al. 2024).
Trainer Trains a network on the data and returns its Laplace posterior.

Without BoTorch

A surrogate for inputs that aren’t tensors, and acquisition functions over a set of candidates.

LaplaceDiscreteSurrogate A Laplace-approximated network, trained on the data, as a surrogate.
Prediction The posterior over the outcomes at some inputs, in the outcomes’ own units.
discrete_acqf.expected_improvement How much each candidate is expected to improve on best.
discrete_acqf.upper_confidence_bound An optimistic guess: the mean plus beta standard deviations.
discrete_acqf.thompson_sampling The values of one function drawn from the posterior.
discrete_acqf.thompson_batch The indices of q different candidates to evaluate together.

Language models

laplacekit_bayesopt.llm, with pip install "laplacekit-bayesopt[llm]".

llm.LoRARegressor A pretrained language model with LoRA adapters and an MLP head, on texts.
llm.TextEncoder A pretrained language model that turns each text into one vector.
llm.LoRAFinetune Fine-tune the adapters and the head, then the head alone, then fit the Laplace approximation.