deephyper.skopt.sampler.Hammersly

deephyper.skopt.sampler.Hammersly#

class deephyper.skopt.sampler.Hammersly(min_skip=0, max_skip=0, primes=None)[source]#

Bases: InitialPointGenerator

Creates Hammersley sequence samples.

The Hammersley set is equivalent to the Halton sequence, except for one dimension is replaced with a regular grid. It is not recommended to generate a Hammersley sequence with more than 10 dimension.

For dim == 1 the sequence falls back to Van Der Corput sequence.

References:#

T-T. Wong, W-S. Luk, and P-A. Heng, “Sampling with Hammersley and Halton Points,” Journal of Graphics Tools, vol. 2, no. 2, 1997, pp. 9 - 24.

param min_skip:

Minimum skipped seed number. When min_skip != max_skip and both are > -1, a random number is picked.

type min_skip:

int, default=-1

param max_skip:

Maximum skipped seed number. When min_skip != max_skip and both are > -1, a random number is picked.

type max_skip:

int, default=-1

param primes:

The (non-)prime base to calculate values along each axis. If empty, growing prime values starting from 2 will be used.

type primes:

tuple, default=None

Methods

generate

Creates samples from Hammersly set.

set_params

Set the parameters of this initial point generator.

generate(dimensions, n_samples, random_state=None)[source]#

Creates samples from Hammersly set.

Args: dimensions : list, 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 Hammersley 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: np.array, shape=(n_dim, n_samples)

Hammersley set.

set_params(**params)#

Set the parameters of this initial point generator.

Args: **params : dict

Generator parameters.

Returns: self : object

Generator instance.