liveBook · Manning

SobolEngine

As explained in Bayesian Optimization in Action

SobolEngine is a PyTorch quasi-random sampling class that generates Sobol-sequence points in a unit cube.

SobolEngine generates quasi-random Sobol-sequence points in a unit cube. Its even space coverage makes it useful for populating candidates in expensive black-box optimization and Thompson sampling. section 5.3.2

Use SobolEngine by following these practical steps:

  • Set the dimensionality and candidate count, then draw points with scramble enabled. section 5.3.2
  • Resize the unit-cube tensor to the bounds of the actual search space. section 5.3.2
  • Provide the candidates to Thompson sampling, which selects a point using a posterior Gaussian-process sample. section 5.3.2

Candidate generation

A one-dimensional setup draws 1,000 scrambled candidates with torch.quasirandom.SobolEngine(1, scramble=True), then maps them from [0, 1] to [-5, 5] before selecting the next evaluation. section 5.3.2

Figure 5.14 Points from a Sobol sequence vs. uniformly sampled points in the two-dimensional unit square. The Sobol sequence covers the square more evenly and, therefore, should be used by TS.

Compare Sobol points with uniformly sampled points to see why Sobol sequences cover the square more evenly. section 5.3.2

How Bayesian Optimization in Action covers it

How deep it goes
Defines the unit-cube API and workflow but defers detailed Sobol-sequence theory.
Examples
Uses scrambled one-dimensional candidates, [-5, 5] rescaling, and a two-dimensional coverage comparison.
What it assumes
Assumes familiarity with tensors and search spaces while explaining unit-cube sampling from the implementation level.
What you can do after
Apply PyTorch's SobolEngine to generate and rescale candidate points for black-box optimization.
How it connects
Connects quasi-random sampling with Thompson sampling, Gaussian processes, and BoTorch.

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.