liveBook · Manning

MaxPosteriorSampling

As explained in Bayesian Optimization in Action

MaxPosteriorSampling is a BoTorch sampler that draws posterior samples at candidate points and selects candidates maximizing those samples.

MaxPosteriorSampling implements Thompson sampling for Bayesian optimization: it draws a sample from a trained Gaussian-process posterior over candidate points, then selects the point with the largest sampled value. section 5.3.2

A typical candidate-selection step proceeds as follows:

  • Generate a broad candidate set with a scrambled Sobol sequence; use at least 1,000 points for reliable coverage. section 5.3.2
  • Construct the sampler from the fitted GP with replacement=False, then request the candidate maximizing one posterior sample. section 5.3.2
  • Evaluate the selected point, append its observation to the training data, and repeat the optimization loop. section 5.3.2

BoTorch candidate selection

Use `botorch.generation.MaxPosteriorSampling(model, replacement=False)` and call it with `next_x = ts(candidate_x, num_samples=1)`. In the Forrester-function loop, sampled candidates initially explore and then concentrate near the global optimum. section 5.3.2

How Bayesian Optimization in Action covers it

How deep it goes
Explains candidate generation, posterior sampling, maximization, and loop integration, while relying on the fitted GP internally.
Examples
Demonstrates BoTorch code in a Forrester-function loop with Sobol candidates and visualized optimization progress.
What it assumes
Assumes a Gaussian process trained on observed data and a defined candidate set.
What you can do after
Apply it via BoTorch to select and evaluate the next candidate from generated points.
How it connects
Connects Thompson sampling with Gaussian processes, Sobol sequences, and Bayesian optimization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bayesian Optimization in Action. The section links point to the parts of the book it draws on.