smac.epm.gp_base_prior module

class smac.epm.gp_base_prior.GammaPrior(a: float, scale: float, loc: float, rng: numpy.random.mtrand.RandomState)

Bases: smac.epm.gp_base_prior.Prior

_gradient(theta: float) float

As computed by Wolfram Alpha

Parameters

theta (float) – A hyperparameter configuration

Returns

Return type

float

_lnprob(theta: float) float

Returns the logpdf of theta.

Parameters

theta (float) – Hyperparameter configuration

Returns

Return type

float

_sample_from_prior(n_samples: int) numpy.ndarray

Returns N samples from the prior.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

class smac.epm.gp_base_prior.HorseshoePrior(scale: float, rng: numpy.random.mtrand.RandomState)

Bases: smac.epm.gp_base_prior.Prior

_gradient(theta: float) float

Computes the gradient of the prior with respect to theta.

Parameters

theta ((D,) numpy array) – Hyperparameter configuration

Returns

The gradient of the prior at theta.

Return type

  1. np.array

_lnprob(theta: float) float

Return the log probability of theta.

Parameters

theta ((D,) numpy array) – A hyperparameter configuration

Returns

Return type

float

_sample_from_prior(n_samples: int) numpy.ndarray

Returns N samples from the prior.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

class smac.epm.gp_base_prior.LognormalPrior(sigma: float, rng: numpy.random.mtrand.RandomState, mean: float = 0)

Bases: smac.epm.gp_base_prior.Prior

_gradient(theta: float) float

Computes the gradient of the prior with respect to theta.

Parameters

theta ((D,) numpy array) – Hyperparameter configuration in log space

Returns

The gradient of the prior at theta.

Return type

  1. np.array

_lnprob(theta: float) float

Return the log probability of theta

Parameters

theta (float) – A hyperparameter configuration

Returns

Return type

float

_sample_from_prior(n_samples: int) numpy.ndarray

Returns N samples from the prior.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

class smac.epm.gp_base_prior.Prior(rng: numpy.random.mtrand.RandomState)

Bases: object

_gradient(theta: float) float

Computes the gradient of the prior with respect to theta.

Parameters

theta (float) – Hyperparameter configuration in the original space space

Returns

The gradient of the prior at theta.

Return type

float

_lnprob(theta: float) float

Return the log probability of theta.

Theta must be on the original scale.

Parameters

theta (float) – Hyperparameter configuration on the original scale.

Returns

The log probability of theta

Return type

float

_sample_from_prior(n_samples: int) numpy.ndarray

Returns n_samples from the prior.

All samples are on a original scale.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

gradient(theta: float) float

Computes the gradient of the prior with respect to theta.

Theta must be on the original scale.

Parameters

theta (float) – Hyperparameter configuration in log space

Returns

The gradient of the prior at theta.

Return type

float

lnprob(theta: float) float

Return the log probability of theta.

Theta must be on a log scale! This method exponentiates theta and calls self._lnprob.

Parameters

theta (float) – Hyperparameter configuration in log space.

Returns

The log probability of theta

Return type

float

sample_from_prior(n_samples: int) numpy.ndarray

Returns n_samples from the prior.

All samples are on a log scale. This method calls self._sample_from_prior and applies a log transformation to the obtained values.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

class smac.epm.gp_base_prior.SoftTopHatPrior(lower_bound: float, upper_bound: float, exponent: float, rng: numpy.random.mtrand.RandomState)

Bases: smac.epm.gp_base_prior.Prior

_sample_from_prior(n_samples: int) numpy.ndarray

Returns N samples from the prior.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

gradient(theta: float) float

Computes the gradient of the prior with respect to theta.

Theta must be on the original scale.

Parameters

theta (float) – Hyperparameter configuration in log space

Returns

The gradient of the prior at theta.

Return type

float

lnprob(theta: float) float

Return the log probability of theta.

Theta must be on a log scale! This method exponentiates theta and calls self._lnprob.

Parameters

theta (float) – Hyperparameter configuration in log space.

Returns

The log probability of theta

Return type

float

class smac.epm.gp_base_prior.TophatPrior(lower_bound: float, upper_bound: float, rng: numpy.random.mtrand.RandomState)

Bases: smac.epm.gp_base_prior.Prior

_lnprob(theta: float) float

Return the log probability of theta.

Parameters

theta (float) – A hyperparameter configuration

Returns

Return type

float

_sample_from_prior(n_samples: int) numpy.ndarray

Return n_samples from the prior.

Parameters

n_samples (int) – The number of samples that will be drawn.

Returns

Return type

np.ndarray

gradient(theta: float) float

Computes the gradient of the prior with respect to theta.

Parameters

theta (float) – Hyperparameter configuration in log space

Returns

The gradient of the prior at theta.

Return type

  1. np.array