Gaussian Process

class deepobs.tuner.GP(optimizer_class, hyperparam_names, bounds, ressources, runner, transformations=None)[source]

Bases: deepobs.tuner.tuner.Tuner

A Bayesian optimization tuner that uses a Gaussian Process surrogate.

__init__(optimizer_class, hyperparam_names, bounds, ressources, runner, transformations=None)[source]
Parameters:
  • optimizer_class (framework optimizer class) -- The optimizer to tune.
  • hyperparam_names (dict) -- Nested dictionary that holds the name, type and default values of the hyperparameters
  • bounds (dict) -- A dict where the key is the hyperparameter name and the value is a tuple of its bounds.
  • ressources (int) -- The number of total evaluations of the tuning process.
  • transformations (dict) -- A dict where the key is the hyperparameter name and the value is a callable that returns the transformed hyperparameter.
  • runner -- The DeepOBS runner which is used for each evaluation.
tune(testproblem, output_dir='./results', random_seed=42, n_init_samples=5, tuning_summary=True, plotting_summary=True, kernel=None, acq_type='ucb', acq_kappa=2.576, acq_xi=0.0, mode='final', rerun_best_setting=False, **kwargs)[source]

Tunes the optimizer hyperparameters by evaluating a Gaussian process surrogate with an acquisition function. :param testproblem: The test problem to tune the optimizer on. :type testproblem: str :param output_dir: The output directory for the results. :type output_dir: str :param random_seed: Random seed for the whole truning process. Every individual run is seeded by it. :type random_seed: int :param n_init_samples: The number of random exploration samples in the beginning of the tuning process. :type n_init_samples: int :param tuning_summary: Whether to write an additional tuning summary. Can be used to get an overview over the tuning progress :type tuning_summary: bool :param plotting_summary: Whether to store additional objects that can be used to plot the posterior. :type plotting_summary: bool :param kernel: The kernel of the GP. :type kernel: Sklearn.gaussian_process.kernels.Kernel :param acq_type: The type of acquisition function to use. Muste be one of ucb, ei, poi. :type acq_type: str :param acq_kappa: Scaling parameter of the acquisition function. :type acq_kappa: float :param acq_xi: Scaling parameter of the acquisition function. :type acq_xi: float :param mode: The mode that is used to evaluate the cost. Must be one of final or best. :type mode: str :param rerun_best_setting: Whether to automatically rerun the best setting with 10 different seeds. :type rerun_best_setting: bool

tune_on_testset(testset, *args, **kwargs)

Tunes the hyperparameter on a whole testset. :param testset: A list of testproblems. :type testset: list