hbayes.util

acq_max

hbayes.util.acq_max(ac, gp, y_max, bounds, random_state, n_warmup=10000, n_iter=10)[source]
Overview:

A function to find the maximum of the acquisition function.

It uses a combination of random sampling (cheap) and the ‘L-BFGS-B’ optimization method. First by sampling n_warmup (1e5) points at random, and then running L-BFGS-B from n_iter (250) random starting points.

Parameters
  • ac – The acquisition function object that return its point-wise value.

  • gp – A gaussian process fitted to the relevant data.

  • y_max – The current maximum known value of the target function.

  • bounds – The variables bounds to limit the search of the acq max.

  • random_state – instance of np.RandomState random number generator

  • n_warmup – number of times to randomly sample the acquisition function

  • n_iter – number of times to run scipy.minimize.

Returns

x_max, The arg max of the acquisition function.

UtilityFunction

class hbayes.util.UtilityFunction(kind, kappa, xi, kappa_decay=1, kappa_decay_delay=0)[source]
Overview:

An object to compute the acquisition functions.

__init__(kind, kappa, xi, kappa_decay=1, kappa_decay_delay=0)[source]

Initialize self. See help(type(self)) for accurate signature.

load_logs

hbayes.util.load_logs(optimizer, logs)[source]
Overview:

Load previous progress log.

ensure_rng

hbayes.util.ensure_rng(state=None)[source]
Overview:

Creates a random number generator based on an optional seed. This can be an integer or another random state for a seeded rng, or None for an unseeded rng.

Parameters

state – Random state. If integer is given, it will be used as the random seed. If np.random.RandomState is given, it will be directly used. Default is None which means use the unseeded random generator.