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.
Additional keyword arguments include inputdict, and use_patsy, which control how strings
are parsed to mean functions, if using.
-
class
mogp_emulator.MultiOutputGP.MultiOutputGP(inputs, targets, mean=None, kernel=<mogp_emulator.Kernel.SquaredExponential object>, 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
inputsandtargets, both of which must be numpy arrays.inputscan be 1D or 2D (if 1D, assumes second axis has length 1).targetscan 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
GaussianProcessclass, 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.Additional keyword arguments include
inputdict, anduse_patsy, which control how strings are parsed to mean functions, if using.-
__init__(inputs, targets, mean=None, kernel=<mogp_emulator.Kernel.SquaredExponential object>, priors=None, nugget='adaptive', inputdict={}, use_patsy=True)¶ Create a new multi-output GP Emulator
-
predict(testing, unc=True, deriv=True, include_nugget=True, 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, wheren_predictis the number of different prediction points under consideration andDis the number of inputs to the emulator. If the prediction inputs array has shape(D,), then the method assumesn_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, theinclude_nuggetflag determines if the uncertainties should include the nugget. By default, this is set toTrue.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
Falsethe method returnsNonein place of the uncertainty array. Default value isTrue. - deriv (bool) – (optional) Flag indicating if the derivatives are to be computed.
If
Falsethe method returnsNonein place of the derivative array. Default value isTrue. - include_nugget (bool) – (optional) Flag indicating if the nugget should be included
in the predictive variance. Only relevant if
unc = True. Default isTrue. - processes (int or None) – (optional) Number of processes to use when making the predictions.
Must be a positive integer or
Noneto use the number of processors on the computer (default isNone)
Returns: Tuple of numpy arrays holding 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 thedo_uncordo_derivflags are set toFalse, then those arrays are replaced byNone.Return type: tuple
- testing (ndarray) – Array-like object holding the points where predictions will be made.
Must have shape
-