The GaussianProcessGPU Class

extends GaussianProcess with an (optional) GPU implementation

class mogp_emulator.GaussianProcessGPU.GaussianProcessGPU(inputs, targets, mean=None, kernel=<mogp_emulator.Kernel.SquaredExponential object>, priors=None, nugget='adaptive', inputdict={}, use_patsy=True, max_batch_size=2000)

This class implements the same interface as mogp_emulator.GaussianProcess.GaussianProcess, but using a GPU if available. Will raise a RuntimeError if a CUDA-compatible GPU, GPU-interface library libgpgpu could not be found. Note that while the class uses a C++/CUDA implementation of the SquaredExponential or Matern52 kernels for the “fit” and “predict” methods, the ‘kernel’ data member (and hence the results of e.g. ‘gp.kernel.kernel_f(theta)’ will be the pure Python versions, for compatibility with the interface of the GaussianProcess class.

__init__(inputs, targets, mean=None, kernel=<mogp_emulator.Kernel.SquaredExponential object>, priors=None, nugget='adaptive', inputdict={}, use_patsy=True, max_batch_size=2000)

Initialize self. See help(type(self)) for accurate signature.

D

Returns number of inputs (dimensions) for the emulator

Returns:Number of inputs for the emulator object
Return type:int
Kinv_t

Return the product of inverse covariance matrix with the target values

Returns:np.array
L

Return the lower triangular Cholesky factor.

Returns:np.array
current_logpost

Return the current value of the log posterior. This is cached in the C++ class.

Returns:double
fit(theta)

Fits the emulator and sets the parameters.

Implements the same interface as mogp_emulator.GaussianProcess.GaussianProcess.fit()

get_K_matrix()

Returns current value of the inverse covariance matrix as a numpy array.

Does not include the nugget parameter, as this is dependent on how the nugget is fit.

inputs

Returns inputs for the emulator as a numpy array

Returns:Emulator inputs, 2D array with shape (n, D)
Return type:ndarray
logpost_deriv(theta)

Calculate the partial derivatives of the negative log-posterior

See mogp_emulator.GaussianProcess.GaussianProcess.logpost_deriv()

Parameters:theta (ndarray) – Value of the hyperparameters. Must be array-like with shape (n_params,)
Returns:partial derivatives of the negative log-posterior with respect to the hyperparameters (array with shape (n_params,))
Return type:ndarray
logpost_hessian(theta)

Calculate the Hessian of the negative log-posterior

See mogp_emulator.GaussianProcess.GaussianProcess.logpost_hessian()

Parameters:theta (ndarray) – Value of the hyperparameters. Must be array-like with shape (n_params,)
Returns:Hessian of the negative log-posterior (array with shape (n_params, n_params))
Return type:ndarray
logposterior(theta)

Calculate the negative log-posterior at a particular value of the hyperparameters

See mogp_emulator.GaussianProcess.GaussianProcess.logposterior()

Parameters:theta (ndarray) – Value of the hyperparameters. Must be array-like with shape (n_params,)
Returns:negative log-posterior
Return type:float
n

Returns number of training examples for the emulator

Returns:Number of training examples for the emulator object
Return type:int
n_corr

Returns number of correlation length parameters

Returns:Number of parameters
Return type:int
n_params

Returns number of hyperparameters

Returns the number of hyperparameters for the emulator. The number depends on the choice of mean function, covariance function, and nugget strategy, and possibly the number of inputs for certain choices of the mean function.

Returns:Number of hyperparameters
Return type:int
nugget

See mogp_emulator.GaussianProcess.GaussianProcess.nugget()

Use the value cached in the C++ class, as we can’t rely on the Python fit() function being called.

nugget_type

Returns method used to select nugget parameter

Returns a string indicating how the nugget parameter is treated, either "adaptive", "fit", or "fixed". This is automatically set when changing the nugget property.

Returns:Current nugget fitting method
Return type:str
predict(testing, unc=True, deriv=True, include_nugget=True)

Make a prediction for a set of input vectors for a single set of hyperparameters. This method implements the same interface as mogp_emulator.GaussianProcess.GaussianProcess.predict()

priors

Returns the Python binding to the C++ GPPriors object, which holds MeanPriors, correlation_length priors, covariance prior, and nugget prior

targets

Returns targets for the emulator as a numpy array

Returns:Emulator targets, 1D array with shape (n,)
Return type:ndarray
theta

Returns emulator hyperparameters see mogp_emulator.GaussianProcess.GaussianProcess.theta()