skopt.sampler.Sobol

class skopt.sampler.Sobol(skip=0, randomize=True)[source][source]

Generates a new quasirandom Sobol’ vector with each call.

Parameters
skipint

Skipped seed number.

randomizebool, default=False

When set to True, random shift is applied.

Notes

Sobol’ sequences [1] provide \(n=2^m\) low discrepancy points in \([0,1)^{dim}\). Scrambling them makes them suitable for singular integrands, provides a means of error estimation, and can improve their rate of convergence.

There are many versions of Sobol’ sequences depending on their ‘direction numbers’. Here, the maximum number of dimension is 40.

The routine adapts the ideas of Antonov and Saleev [2].

Warning

Sobol’ sequences are a quadrature rule and they lose their balance properties if one uses a sample size that is not a power of 2, or skips the first point, or thins the sequence [5].

If \(n=2^m\) points are not enough then one should take \(2^M\) points for \(M>m\). When scrambling, the number R of independent replicates does not have to be a power of 2.

Sobol’ sequences are generated to some number \(B\) of bits. Then after \(2^B\) points have been generated, the sequence will repeat. Currently \(B=30\).

References

1

I. M. Sobol. The distribution of points in a cube and the accurate evaluation of integrals. Zh. Vychisl. Mat. i Mat. Phys., 7:784-802, 1967.

2

Antonov, Saleev, USSR Computational Mathematics and Mathematical Physics, Volume 19, 1980, pages 252 - 256.

3

Paul Bratley, Bennett Fox, Algorithm 659: Implementing Sobol’s Quasirandom Sequence Generator, ACM Transactions on Mathematical Software, Volume 14, Number 1, pages 88-100, 1988.

4

Bennett Fox, Algorithm 647: Implementation and Relative Efficiency of Quasirandom Sequence Generators,

5

Art B. Owen. On dropping the first Sobol’ point. arXiv 2008.08051, 2020.

Methods

generate(dimensions, n_samples[, random_state])

Creates samples from Sobol' set.

set_params(**params)

Set the parameters of this initial point generator.

init

__init__(skip=0, randomize=True)[source][source]
generate(dimensions, n_samples, random_state=None)[source][source]

Creates samples from Sobol’ set.

Parameters
dimensionslist, shape (n_dims,)

List of search space dimensions. Each search dimension can be defined either as

  • a (lower_bound, upper_bound) tuple (for Real or Integer dimensions),

  • a (lower_bound, upper_bound, "prior") tuple (for Real dimensions),

  • as a list of categories (for Categorical dimensions), or

  • an instance of a Dimension object (Real, Integer or Categorical).

n_samplesint

The order of the Sobol’ sequence. Defines the number of samples.

random_stateint, RandomState instance, or None (default)

Set random state to something other than None for reproducible results.

Returns
samplearray_like (n_samples, dim)

Sobol’ set.

set_params(**params)[source]

Set the parameters of this initial point generator.

Parameters
**paramsdict

Generator parameters.

Returns
——-
selfobject

Generator instance.

Examples using skopt.sampler.Sobol