autoemulate.emulators.gaussian_process#

class GaussianProcess(mean_module=None, covar_module=None, lr=0.2, optimizer=<class 'torch.optim.adamw.AdamW'>, max_epochs=50, normalize_y=True, device='cpu', random_state=None)[source]#

Bases: RegressorMixin, BaseEstimator

Exact Gaussian Process emulator build with GPyTorch.

Batched Multi-Output GP, treating outputs independently.

Parameters:
  • mean_module (GP mean, defaults to gpytorch.means.ConstantMean() when None)

  • covar_module (GP covariance, defaults to gpytorch.kernels.RBFKernel() when None)

  • lr (learning rate, default=1e-1)

  • optimizer (optimizer, default=torch.optim.AdamW)

  • max_epochs (maximum number of epochs, default=30)

  • normalize_y (whether to normalize the target values, default=True)

  • device (device to use, defaults to "cuda" if available, otherwise "cpu")

  • random_state (random seed, default=None)

fit(X, y)[source]#

Fit the emulator to the data.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – The input data.

  • y (array-like of shape (n_samples, )) – The output data.

Returns:

self – Returns self.

Return type:

object

predict(X, return_std=False)[source]#

Predict the output of the emulator.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – The input data.

  • return_std (bool, default=False) – Whether to return the standard deviation.

Returns:

y – The predicted output.

Return type:

array-like of shape (n_samples, )

get_grid_params(search_type='random')[source]#

Returns the grid parameters for the emulator.

set_predict_request(*, return_std='$UNCHANGED$')#

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

return_std (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_std parameter in predict.

Returns:

self – The updated object.

Return type:

object