bayeso.wrappers.wrappers_bo_function

It defines wrappers for Bayesian optimization.

bayeso.wrappers.wrappers_bo_function.run_single_round(model_bo: bayeso.bo.BO, fun_target: Callable, num_init: int, num_iter: int, str_initial_method_bo: str = 'sobol', str_sampling_method_ao: str = 'sobol', num_samples_ao: int = 100, str_mlm_method: str = 'regular', seed: Optional[int] = None) → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]

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

Parameters:
  • model_bo (bayeso.bo.BO) – Bayesian optimization model.
  • fun_target (callable) – a target function.
  • num_init (int.) – the number of initial examples for Bayesian optimization.
  • num_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_sampling_method_ao (str., optional) – the name of initialization method for acquisition function optimization.
  • num_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.
  • 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: ((num_init + num_iter, d), (num_init + num_iter, 1), (num_init + num_iter, ), (num_iter, ), (num_iter, )), or ((num_init + num_iter, m, d), (num_init + num_iter, m, 1), (num_init + num_iter, ), (num_iter, ), (num_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

bayeso.wrappers.wrappers_bo_function.run_single_round_with_all_initial_information(model_bo: bayeso.bo.BO, fun_target: Callable, X_train: numpy.ndarray, Y_train: numpy.ndarray, num_iter: int, str_sampling_method_ao: str = 'sobol', num_samples_ao: int = 100, str_mlm_method: str = 'regular') → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]

It optimizes fun_target for num_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 (callable) – 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).
  • num_iter (int.) – the number of iterations for Bayesian optimization.
  • str_sampling_method_ao (str., optional) – the name of initialization method for acquisition function optimization.
  • num_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 + num_iter, d), (n + num_iter, 1), (num_iter, ), (num_iter, ), (num_iter, )), or ((n + num_iter, m, d), (n + num_iter, m, 1), (num_iter, ), (num_iter, ), (num_iter, )).

Return type:

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

Raises:

AssertionError

bayeso.wrappers.wrappers_bo_function.run_single_round_with_initial_inputs(model_bo: bayeso.bo.BO, fun_target: Callable, X_train: numpy.ndarray, num_iter: int, str_sampling_method_ao: str = 'sobol', num_samples_ao: int = 100, str_mlm_method: str = 'regular') → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]

It optimizes fun_target for num_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 (callable) – a target function.
  • X_train (numpy.ndarray) – initial inputs. Shape: (n, d) or (n, m, d).
  • num_iter (int.) – the number of iterations for Bayesian optimization.
  • str_sampling_method_ao (str., optional) – the name of initialization method for acquisition function optimization.
  • num_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 + num_iter, d), (n + num_iter, 1), (n + num_iter, ), (num_iter, ), (num_iter, )), or ((n + num_iter, m, d), (n + num_iter, m, 1), (n + num_iter, ), (num_iter, ), (num_iter, )).

Return type:

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

Raises:

AssertionError