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¶
load_logs¶
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.RandomStateis given, it will be directly used. Default isNonewhich means use the unseeded random generator.