smac.model.gaussian_process.priors.abstract_prior¶
Classes¶
|
Abstract base class to define the interface for priors of Gaussian process hyperparameters. |
Interfaces¶
- class smac.model.gaussian_process.priors.abstract_prior.AbstractPrior(seed=0)[source]¶
Bases:
object
Abstract base class to define the interface for priors of Gaussian process hyperparameters.
This class is adapted from 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
Note
Whenever lnprob or the gradient is computed for a scalar input, we use math.* rather than np.*.
- Parameters:
seed (int, defaults to 0)
- get_gradient(theta)[source]¶
Computes the gradient of the prior with respect to theta. Internally, his method calls self._get_gradient.
Warning
Theta must be on the original scale.
- Parameters:
theta (float) – Hyperparameter configuration in log space
- Returns:
gradient – The gradient of the prior at theta.
- Return type:
float
- get_log_probability(theta)[source]¶
Returns the log probability of theta. This method exponentiates theta and calls self._get_log_probability.
Warning
Theta must be on a log scale!
- Parameters:
theta (float) – Hyperparameter configuration in log space.
- Returns:
The log probability of theta
- Return type:
float
- property meta: dict[str, Any]¶
Returns the meta data of the created object.
- sample_from_prior(n_samples)[source]¶
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:
samples
- Return type:
np.ndarray