smac.epm.gaussian_process_mcmc module

class smac.epm.gaussian_process_mcmc.GaussianProcessMCMC(configspace: ConfigSpace.configuration_space.ConfigurationSpace, types: List[int], bounds: List[Tuple[float, float]], seed: int, kernel: sklearn.gaussian_process.kernels.Kernel, n_mcmc_walkers: int = 20, chain_length: int = 50, burnin_steps: int = 50, normalize_y: bool = True, mcmc_sampler: str = 'emcee', average_samples: bool = False, instance_features: Optional[numpy.ndarray] = None, pca_components: Optional[int] = None)

Bases: smac.epm.base_gp.BaseModel

_get_gp() sklearn.gaussian_process._gpr.GaussianProcessRegressor
_ll(theta: numpy.ndarray) float

Returns the marginal log likelihood (+ the prior) for a hyperparameter configuration theta.

Parameters

theta (np.ndarray(H)) – Hyperparameter vector. Note that all hyperparameter are on a log scale.

Returns

lnlikelihood + prior

Return type

float

_ll_w_grad(theta: numpy.ndarray) Tuple[float, numpy.ndarray]

Returns the marginal log likelihood (+ the prior) for a hyperparameter configuration theta.

Parameters

theta (np.ndarray(H)) – Hyperparameter vector. Note that all hyperparameter are on a log scale.

Returns

lnlikelihood + prior

Return type

float

_predict(X_test: numpy.ndarray, cov_return_type: Optional[str] = 'diagonal_cov') Tuple[numpy.ndarray, numpy.ndarray]

Returns the predictive mean and variance of the objective function at X average over all hyperparameter samples. The mean is computed by: :math mu(x) = frac{1}{M}sum_{i=1}^{M}mu_m(x) And the variance by: :math sigma^2(x) = (frac{1}{M}sum_{i=1}^{M}(sigma^2_m(x) + mu_m(x)^2) - mu^2

Parameters
  • X_test (np.ndarray (N, D)) – Input test points

  • cov_return_type (typing.Optional[str]) – Specifies what to return along with the mean. Refer predict() for more information.

Returns

  • np.array(N,) – predictive mean

  • np.array(N,) – predictive variance

_train(X: numpy.ndarray, y: numpy.ndarray, do_optimize: bool = True) smac.epm.gaussian_process_mcmc.GaussianProcessMCMC

Performs MCMC sampling to sample hyperparameter configurations from the likelihood and trains for each sample a GP on X and y

Parameters
  • X (np.ndarray (N, D)) – Input data points. The dimensionality of X is (N, D), with N as the number of points and D is the number of features.

  • y (np.ndarray (N,)) – The corresponding target values.

  • do_optimize (boolean) – If set to true we perform MCMC sampling otherwise we just use the hyperparameter specified in the kernel.