smac.epm.base_epm module

class smac.epm.base_epm.AbstractEPM(instance_features: numpy.ndarray = None, pca_components: float = None)[source]

Bases: object

Abstract implementation of the EPM API.

Note: The input dimensionality of Y for training and the output dimensions of all predictions (also called n_objectives) depends on the concrete implementation of this abstract class.

instance_features

np.ndarray(I, K) – Contains the K dimensional instance features of the I different instances

pca

sklearn.decomposition.PCA – Object to perform PCA

pca_components

float – Number of components to keep or None

n_feats

int – Number of instance features

n_params

int – Number of parameters in a configuration (only available after train has been called)

scaler

sklearn.preprocessing.MinMaxScaler – Object to scale data to be withing [0, 1]

var_threshold

float – Lower bound vor variance. If estimated variance < var_threshold, the set to var_threshold

types

list – If set, contains a list with feature types (cat,const) of input vector

Constructor

Parameters:
  • instance_features (np.ndarray (I, K)) – Contains the K dimensional instance features of the I different instances
  • pca_components (float) – Number of components to keep when using PCA to reduce dimensionality of instance features. Requires to set n_feats (> pca_dims).
predict(X: numpy.ndarray)[source]

Predict means and variances for given X.

Parameters:X (np.ndarray of shape = [n_samples, n_features (config + instance features)]) – Training samples
Returns:
  • means (np.ndarray of shape = [n_samples, n_objectives]) – Predictive mean
  • vars (np.ndarray of shape = [n_samples, n_objectives]) – Predictive variance
predict_marginalized_over_instances(X: numpy.ndarray)[source]

Predict mean and variance marginalized over all instances.

Returns the predictive mean and variance marginalised over all instances for a set of configurations.

Parameters:X (np.ndarray) – [n_samples, n_features (config)]
Returns:
  • means (np.ndarray of shape = [n_samples, 1]) – Predictive mean
  • vars (np.ndarray of shape = [n_samples, 1]) – Predictive variance
train(X: numpy.ndarray, Y: numpy.ndarray, **kwargs)[source]

Trains the EPM on X and Y.

Parameters:
  • X (np.ndarray [n_samples, n_features (config + instance features)]) – Input data points.
  • Y (np.ndarray [n_samples, n_objectives]) – The corresponding target values. n_objectives must match the number of target names specified in the constructor.
Returns:

self

Return type:

AbstractEPM