smac.epm.uncorrelated_mo_rf_with_instances module

class smac.epm.uncorrelated_mo_rf_with_instances.UncorrelatedMultiObjectiveRandomForestWithInstances(target_names: List[str], configspace: ConfigSpace.configuration_space.ConfigurationSpace, types: List[int], bounds: List[Tuple[float, float]], seed: int, rf_kwargs: Optional[Dict[str, Any]] = None, instance_features: Optional[numpy.ndarray] = None, pca_components: Optional[int] = None)[source]

Bases: smac.epm.base_epm.AbstractEPM

Wrapper for the random forest to predict multiple targets.

Only the a list with the target names and the types array for the underlying forest model are mandatory. All other hyperparameters to the random forest can be passed via kwargs. Consult the documentation of the random forest for the hyperparameters and their meanings.



  • target_names (list) – List of str, each entry is the name of one target dimension. Length of the list will be n_objectives.

  • types (List[int]) – Specifies the number of categorical values of an input dimension where the i-th entry corresponds to the i-th input dimension. Let’s say we have 2 dimension where the first dimension consists of 3 different categorical choices and the second dimension is continuous than we have to pass [3, 0]. Note that we count starting from 0.

  • bounds (List[Tuple[float, float]]) – bounds of input dimensions: (lower, uppper) for continuous dims; (n_cat, np.nan) for categorical dims

  • 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, cov_return_type: Optional[str] = 'diagonal_cov') → Tuple[numpy.ndarray, numpy.ndarray][source]

Predict means and variances for given X.

  • X (np.ndarray of shape = [n_samples, n_features (config + instance) –

  • features)]

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


  • means (np.ndarray of shape = [n_samples, n_objectives]) – Predictive mean

  • vars (np.ndarray of shape = [n_samples, n_objectives]) – Predictive variance

_train(X: numpy.ndarray, Y: numpy.ndarray)smac.epm.uncorrelated_mo_rf_with_instances.UncorrelatedMultiObjectiveRandomForestWithInstances[source]

Trains the random forest on X and y.

  • 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.


Return type


predict_marginalized_over_instances(X: numpy.ndarray) → Tuple[numpy.ndarray, 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.


X (np.ndarray of shape = [n_features (config), ]) –


  • means (np.ndarray of shape = [n_samples, n_objectives]) – Predictive mean

  • vars (np.ndarray of shape = [n_samples, n_objectives]) – Predictive variance