bayeso.utils.utils_bo

bayeso.utils.utils_bo.get_next_best_acquisition(arr_points, arr_acquisitions, cur_points)

It returns the next best acquired example.

Parameters:
  • arr_points (numpy.ndarray) – inputs for acquisition function. Shape: (n, d).
  • arr_acquisitions (numpy.ndarray) – acquisition function values over arr_points. Shape: (n, ).
  • cur_points (numpy.ndarray) – examples evaluated so far. Shape: (m, d).
Returns:

next best acquired point. Shape: (d, ).

Return type:

numpy.ndarray

Raises:

AssertionError

bayeso.utils.utils_bo.optimize_many(model_bo, fun_target, X_train, int_iter, str_initial_method_ao='uniform', int_samples_ao=100, str_mlm_method='regular')

It optimizes fun_target for int_iter iterations with given model_bo and initial inputs X_train. It returns the optimization results and execution times.

Parameters:
  • model_bo (bayeso.bo.BO) – Bayesian optimization model.
  • fun_target (function) – a target function.
  • X_train (numpy.ndarray) – initial inputs. Shape: (n, d) or (n, m, d).
  • int_iter (int.) – the number of iterations for Bayesian optimization.
  • str_initial_method_ao (str., optional) – the name of initialization method for acquisition function optimization.
  • int_samples_ao (int., optional) – the number of samples for acquisition function optimization. If L-BFGS-B is used as an acquisition function optimization method, it is employed.
  • str_mlm_method (str., optional) – the name of marginal likelihood maximization method for Gaussian process regression.
Returns:

tuple of acquired examples, their function values, overall execution times per iteration, execution time consumed in Gaussian process regression, and execution time consumed in acquisition function optimization. Shape: ((n + int_iter, d), (n + int_iter, 1), (n + int_iter, ), (int_iter, ), (int_iter, )), or ((n + int_iter, m, d), (n + int_iter, m, 1), (n + int_iter, ), (int_iter, ), (int_iter, )).

Return type:

(numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray)

Raises:

AssertionError

bayeso.utils.utils_bo.optimize_many_(model_bo, fun_target, X_train, Y_train, int_iter, str_initial_method_ao='uniform', int_samples_ao=100, str_mlm_method='regular')

It optimizes fun_target for int_iter iterations with given model_bo. It returns the optimization results and execution times.

Parameters:
  • model_bo (bayeso.bo.BO) – Bayesian optimization model.
  • fun_target (function) – a target function.
  • X_train (numpy.ndarray) – initial inputs. Shape: (n, d) or (n, m, d).
  • Y_train (numpy.ndarray) – initial outputs. Shape: (n, 1).
  • int_iter (int.) – the number of iterations for Bayesian optimization.
  • str_initial_method_ao (str., optional) – the name of initialization method for acquisition function optimization.
  • int_samples_ao (int., optional) – the number of samples for acquisition function optimization. If L-BFGS-B is used as an acquisition function optimization method, it is employed.
  • str_mlm_method (str., optional) – the name of marginal likelihood maximization method for Gaussian process regression.
Returns:

tuple of acquired examples, their function values, overall execution times per iteration, execution time consumed in Gaussian process regression, and execution time consumed in acquisition function optimization. Shape: ((n + int_iter, d), (n + int_iter, 1), (int_iter, ), (int_iter, ), (int_iter, )), or ((n + int_iter, m, d), (n + int_iter, m, 1), (int_iter, ), (int_iter, ), (int_iter, )).

Return type:

(numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray)

Raises:

AssertionError

bayeso.utils.utils_bo.optimize_many_with_random_init(model_bo, fun_target, int_init, int_iter, str_initial_method_bo='uniform', str_initial_method_ao='uniform', int_samples_ao=100, str_mlm_method='regular', int_seed=None)

It optimizes fun_target for int_iter iterations with given model_bo and int_init initial examples. Initial examples are sampled by get_initial method in model_bo. It returns the optimization results and execution times.

Parameters:
  • model_bo (bayeso.bo.BO) – Bayesian optimization model.
  • fun_target (function) – a target function.
  • int_init (int.) – the number of initial examples for Bayesian optimization.
  • int_iter (int.) – the number of iterations for Bayesian optimization.
  • str_initial_method_bo (str., optional) – the name of initialization method for sampling initial examples in Bayesian optimization.
  • str_initial_method_ao (str., optional) – the name of initialization method for acquisition function optimization.
  • int_samples_ao (int., optional) – the number of samples for acquisition function optimization. If L-BFGS-B is used as an acquisition function optimization method, it is employed.
  • str_mlm_method (str., optional) – the name of marginal likelihood maximization method for Gaussian process regression.
  • int_seed (NoneType or int., optional) – None, or random seed.
Returns:

tuple of acquired examples, their function values, overall execution times per iteration, execution time consumed in Gaussian process regression, and execution time consumed in acquisition function optimization. Shape: ((int_init + int_iter, d), (int_init + int_iter, 1), (int_init + int_iter, ), (int_iter, ), (int_iter, )), or ((int_init + int_iter, m, d), (int_init + int_iter, m, 1), (int_init + int_iter, ), (int_iter, ), (int_iter, )), where d is a dimensionality of the problem we are solving and m is a cardinality of sets.

Return type:

(numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray)

Raises:

AssertionError