The MultiOutputGP Class

Implementation of a multiple-output Gaussian Process Emulator.

Essentially a parallelized wrapper for the predict method. To fit in parallel, use the fit_GP_MAP routine

Required arguments are inputs and targets, both of which must be numpy arrays. inputs can be 1D or 2D (if 1D, assumes second axis has length 1). targets can be 1D or 2D (if 2D, assumes a single emulator and the first axis has length 1).

Optional arguments specify how each individual emulator is constructed, including the mean function, kernel, priors, and how to handle the nugget. Each argument can take values allowed by the base GaussianProcess class, in which case all emulators are assumed to use the same value. Any of these arguments can alternatively be a list of values with length matching the number of emulators to set those values individually.

class mogp_emulator.MultiOutputGP.MultiOutputGP(inputs, targets, mean=None, kernel='SquaredExponential', priors=None, nugget='adaptive', inputdict={}, use_patsy=True)

Implementation of a multiple-output Gaussian Process Emulator.

Essentially a parallelized wrapper for the predict method. To fit in parallel, use the fit_GP_MAP routine

Required arguments are inputs and targets, both of which must be numpy arrays. inputs can be 1D or 2D (if 1D, assumes second axis has length 1). targets can be 1D or 2D (if 2D, assumes a single emulator and the first axis has length 1).

Optional arguments specify how each individual emulator is constructed, including the mean function, kernel, priors, and how to handle the nugget. Each argument can take values allowed by the base GaussianProcess class, in which case all emulators are assumed to use the same value. Any of these arguments can alternatively be a list of values with length matching the number of emulators to set those values individually.

__init__(inputs, targets, mean=None, kernel='SquaredExponential', priors=None, nugget='adaptive', inputdict={}, use_patsy=True)

Create a new multi-output GP Emulator

get_emulators_fit()

Returns the emulators that have been fit

When a MultiOutputGP class is initialized, none of the emulators are fit. Fitting is done by passing the object to an external fitting routine, which modifies the object to fit the hyperparameters. Any emulators where the fitting fails are returned to the initialized state, and this method is used to obtain a list of emulators that have successfully been fit.

Returns a list of GaussianProcess objects which have been fit (i.e. those which have a current valid set of hyperparameters).

Returns:List of GaussianProcess objects indicating the emulators that have been fit. If no emulators have been fit, returns an empty list.
Return type:list of GaussianProcess objects
get_emulators_not_fit()

Returns the indices of the emulators that have not been fit

When a MultiOutputGP class is initialized, none of the emulators are fit. Fitting is done by passing the object to an external fitting routine, which modifies the object to fit the hyperparameters. Any emulators where the fitting fails are returned to the initialized state, and this method is used to obtain a list of emulators that have not been fit.

Returns a list of GaussianProcess objects which have not been fit (i.e. those which do not have a current set of hyperparameters).

Returns:List of GaussianProcess objects indicating the emulators that have not been fit. If all emulators have been fit, returns an empty list.
Return type:list of GaussianProcess objects
get_indices_fit()

Returns the indices of the emulators that have been fit

When a MultiOutputGP class is initialized, none of the emulators are fit. Fitting is done by passing the object to an external fitting routine, which modifies the object to fit the hyperparameters. Any emulators where the fitting fails are returned to the initialized state, and this method is used to determine the indices of the emulators that have succesfully been fit.

Returns a list of non-negative integers indicating the indices of the emulators that have been fit.

Returns:List of integer indicies indicating the emulators that have been fit. If no emulators have been fit, returns an empty list.
Return type:list of int
get_indices_not_fit()

Returns the indices of the emulators that have not been fit

When a MultiOutputGP class is initialized, none of the emulators are fit. Fitting is done by passing the object to an external fitting routine, which modifies the object to fit the hyperparameters. Any emulators where the fitting fails are returned to the initialized state, and this method is used to determine the indices of the emulators that have not been fit.

Returns a list of non-negative integers indicating the indices of the emulators that have not been fit.

Returns:List of integer indicies indicating the emulators that have not been fit. If all emulators have been fit, returns an empty list.
Return type:list of int
predict(testing, unc=True, deriv=False, include_nugget=True, allow_not_fit=False, processes=None)

Make a prediction for a set of input vectors

Makes predictions for each of the emulators on a given set of input vectors. The input vectors must be passed as a (n_predict, D) or (D,) shaped array-like object, where n_predict is the number of different prediction points under consideration and D is the number of inputs to the emulator. If the prediction inputs array has shape (D,), then the method assumes n_predict == 1. The prediction points are passed to each emulator and the predictions are collected into an (n_emulators, n_predict) shaped numpy array as the first return value from the method.

Optionally, the emulator can also calculate the uncertainties in the predictions (as a variance) and the derivatives with respect to each input parameter. If the uncertainties are computed, they are returned as the second output from the method as an (n_emulators, n_predict) shaped numpy array. If the derivatives are computed, they are returned as the third output from the method as an (n_emulators, n_predict, D) shaped numpy array. Finally, if uncertainties are computed, the include_nugget flag determines if the uncertainties should include the nugget. By default, this is set to True.

Derivatives have been deprecated due to changes in how the mean function is computed, so setting deriv=True will have no effect and will raise a DeprecationWarning.

The allow_not_fit flag determines how the object handles any emulators that do not have fit hyperparameter values (because fitting presumably failed). By default, allow_not_fit=False and the method will raise an error if any emulators are not fit. Passing allow_not_fit=True will override this and NaN will be returned from any emulators that have not been fit.

As with the fitting, this computation can be done independently for each emulator and thus can be done in parallel.

Parameters:
  • testing (ndarray) – Array-like object holding the points where predictions will be made. Must have shape (n_predict, D) or (D,) (for a single prediction)
  • unc (bool) – (optional) Flag indicating if the uncertainties are to be computed. If False the method returns None in place of the uncertainty array. Default value is True.
  • include_nugget (bool) – (optional) Flag indicating if the nugget should be included in the predictive variance. Only relevant if unc = True. Default is True.
  • allow_not_fit (bool) – (optional) Flag that allows predictions to be made even if not all emulators have been fit. Default is False which will raise an error if any unfitted emulators are present.
  • processes (int or None) – (optional) Number of processes to use when making the predictions. Must be a positive integer or None to use the number of processors on the computer (default is None)
Returns:

PredictResult object holding numpy arrays containing the predictions, uncertainties, and derivatives, respectively. Predictions and uncertainties have shape (n_emulators, n_predict) while the derivatives have shape (n_emulators, n_predict, D). If the do_unc or do_deriv flags are set to False, then those arrays are replaced by None.

Return type:

PredictResult