GPyOpt.core package

Submodules

GPyOpt.core.bo module

class GPyOpt.core.bo.BO(model, space, objective, acquisition, evaluator, X_init, Y_init=None, cost=None, normalize_Y=True, model_update_interval=1, de_duplication=False)

Bases: object

Runner of Bayesian optimization loop. This class wraps the optimization loop around the different handlers. :param model: GPyOpt model class. :param space: GPyOpt space class. :param objective: GPyOpt objective class. :param acquisition: GPyOpt acquisition class. :param evaluator: GPyOpt evaluator class. :param X_init: 2d numpy array containing the initial inputs (one per row) of the model. :param Y_init: 2d numpy array containing the initial outputs (one per row) of the model. :param cost: GPyOpt cost class (default, none). :param normalize_Y: whether to normalize the outputs before performing any optimization (default, True). :param model_update_interval: interval of collected observations after which the model is updated (default, 1). :param de_duplication: GPyOpt DuplicateManager class. Avoids re-evaluating the objective at previous, pending or infeasible locations (default, False).

evaluate_objective()

Evaluates the objective

get_evaluations()
plot_acquisition(filename=None)
Plots the model and the acquisition function.
if self.input_dim = 1: Plots data, mean and variance in one plot and the acquisition function in another plot if self.input_dim = 2: as before but it separates the mean and variance of the model in two different plots
Parameters:filename – name of the file where the plot is saved
plot_convergence(filename=None)
Makes twp plots to evaluate the convergence of the model:
plot 1: Iterations vs. distance between consecutive selected x’s plot 2: Iterations vs. the mean of the current model in the selected sample.
Parameters:filename – name of the file where the plot is saved
run_optimization(max_iter=0, max_time=inf, eps=1e-08, context=None, verbosity=False, save_models_parameters=True, report_file=None, evaluations_file=None, models_file=None)

Runs Bayesian Optimization for a number ‘max_iter’ of iterations (after the initial exploration data)

Parameters:
  • max_iter – exploration horizon, or number of acquisitions. If nothing is provided optimizes the current acquisition.
  • max_time – maximum exploration horizon in seconds.
  • eps – minimum distance between two consecutive x’s to keep running the model.
  • verbosity – flag to print the optimization results after each iteration (default, False).
  • report_file – filename of the file where the results of the optimization are saved (default, None).
  • context – fixes specified variables to a particular context (values) for the optimization run (default, None).
save_evaluations(evaluations_file=None)

Saves a report with the results of the iterations of the optimization

Parameters:evaluations_file – name of the file in which the results are saved.
save_models(models_file)

Saves a report with the results of the iterations of the optimization

Parameters:models_file – name of the file or a file buffer, in which the results are saved.
save_report(report_file=None)

Saves a report with the main resutls of the optimization.

Parameters:report_file – name of the file in which the results of the optimization are saved.
suggest_next_locations(context=None, pending_X=None, ignored_X=None)

Run a single optimization step and return the next locations to evaluate the objective. Number of suggested locations equals to batch_size.

Parameters:
  • context – fixes specified variables to a particular context (values) for the optimization run (default, None).
  • pending_X – matrix of input configurations that are in a pending state (i.e., do not have an evaluation yet) (default, None).
  • ignored_X – matrix of input configurations that the user black-lists, i.e., those configurations will not be suggested again (default, None).

GPyOpt.core.errors module

exception GPyOpt.core.errors.FullyExploredOptimizationDomainError

Bases: exceptions.Exception

exception GPyOpt.core.errors.InvalidConfigError

Bases: exceptions.Exception

exception GPyOpt.core.errors.InvalidVariableNameError

Bases: exceptions.Exception

Module contents