smac.model.gaussian_process

Interfaces

class smac.model.gaussian_process.AbstractGaussianProcess(configspace, kernel, instance_features=None, pca_components=7, seed=0)[source]

Bases: AbstractModel

Abstract base class for all Gaussian process models.

Parameters:
  • configspace (ConfigurationSpace)

  • kernel (Kernel) – Kernel which is used for the Gaussian process.

  • instance_features (dict[str, list[int | float]] | None, defaults to None) – Features (list of int or floats) of the instances (str). The features are incorporated into the X data, on which the model is trained on.

  • pca_components (float, defaults to 7) – Number of components to keep when using PCA to reduce dimensionality of instance features.

  • seed (int)

property meta: dict[str, Any]

Returns the meta data of the created object.

class smac.model.gaussian_process.GaussianProcess(configspace, kernel, n_restarts=10, normalize_y=True, instance_features=None, pca_components=7, seed=0)[source]

Bases: AbstractGaussianProcess

Implementation of Gaussian process model. The Gaussian process hyperparameters are obtained by optimizing the marginal log likelihood.

This code is based on the implementation of RoBO: Klein, A. and Falkner, S. and Mansur, N. and Hutter, F. RoBO: A Flexible and Robust Bayesian Optimization Framework in Python In: NIPS 2017 Bayesian Optimization Workshop

Parameters:
  • configspace (ConfigurationSpace)

  • kernel (Kernel) – Kernel which is used for the Gaussian process.

  • n_restarts (int, defaults to 10) – Number of restarts for the Gaussian process hyperparameter optimization.

  • normalize_y (bool, defaults to True) – Zero mean unit variance normalization of the output values.

  • instance_features (dict[str, list[int | float]] | None, defaults to None) – Features (list of int or floats) of the instances (str). The features are incorporated into the X data, on which the model is trained on.

  • pca_components (float, defaults to 7) – Number of components to keep when using PCA to reduce dimensionality of instance features.

  • seed (int)

property meta: dict[str, Any]

Returns the meta data of the created object.

sample_functions(X_test, n_funcs=1)[source]

Samples F function values from the current posterior at the N specified test points.

Parameters:
  • X (np.ndarray [#samples, #hyperparameters + #features]) – Input data points.

  • n_funcs (int) – Number of function values that are drawn at each test point.

Returns:

function_samples – The F function values drawn at the N test points.

Return type:

np.ndarray

class smac.model.gaussian_process.MCMCGaussianProcess(configspace, kernel, n_mcmc_walkers=20, chain_length=50, burning_steps=50, mcmc_sampler='emcee', average_samples=False, normalize_y=True, instance_features=None, pca_components=7, seed=0)[source]

Bases: AbstractGaussianProcess

Implementation of a Gaussian process model which out-integrates its hyperparameters by Markow-Chain-Monte-Carlo (MCMC). If you use this class make sure that you also use an integrated acquisition function to integrate over the GP’s hyperparameter as proposed by Snoek et al.

This code is based on the implementation of RoBO:

Klein, A. and Falkner, S. and Mansur, N. and Hutter, F. RoBO: A Flexible and Robust Bayesian Optimization Framework in Python In: NIPS 2017 Bayesian Optimization Workshop

Parameters:
  • configspace (ConfigurationSpace)

  • kernel (Kernel) – Kernel which is used for the Gaussian process.

  • n_mcmc_walkers (int, defaults to 20) – The number of hyperparameter samples. This also determines the number of walker for MCMC sampling as each walker will return one hyperparameter sample.

  • chain_length (int, defaults to 50) – The length of the MCMC chain. We start n_mcmc_walkers walker for chain_length steps, and we use the last sample in the chain as a hyperparameter sample.

  • burning_steps (int, defaults to 50) – The number of burning steps before the actual MCMC sampling starts.

  • mcmc_sampler (str, defaults to "emcee") – Choose a self-tuning MCMC sampler. Can be either emcee or nuts.

  • normalize_y (bool, defaults to True) – Zero mean unit variance normalization of the output values.

  • instance_features (dict[str, list[int | float]] | None, defaults to None) – Features (list of int or floats) of the instances (str). The features are incorporated into the X data, on which the model is trained on.

  • pca_components (float, defaults to 7) – Number of components to keep when using PCA to reduce dimensionality of instance features.

  • seed (int)

property meta: dict[str, Any]

Returns the meta data of the created object.

property models: list[GaussianProcess]

Returns the internally used gaussian processes.

Modules

abstract_gaussian_process

gaussian_process

gpytorch_gaussian_process

kernels

mcmc_gaussian_process

priors