GaussianProcessRegression

(Source code, svg)

../../_images/GaussianProcessRegression.svg
class GaussianProcessRegression(*args)

Gaussian process regression algorithm.

Warning

This class is experimental and likely to be modified in future releases. To use it, import the openturns.experimental submodule.

Available constructors:

GaussianProcessRegression(gprFitterResult)

GaussianProcessRegression(inputSample, outputSample, covarianceModel, trendFunction)

Parameters:
gprFitterResultGaussianProcessFitterResult

The result class built by GaussianProcessFitter.

inputSample, outputSample2-d sequence of float

The samples (\vect{x}_k)_{1 \leq k \leq \sampleSize} \in \Rset^{\inputDim} and (\vect{y}_k)_{1 \leq k \leq \sampleSize} \in \Rset^{\outputDim} upon which the meta-model is built.

covarianceModelCovarianceModel

The covariance model used for the underlying Gaussian process approximation.

trendFunctionFunction

The trend function.

Methods

BuildDistribution(inputSample)

Recover the distribution, with metamodel performance in mind.

getClassName()

Accessor to the object's name.

getDistribution()

Accessor to the joint probability density function of the physical input vector.

getInputSample()

Accessor to the input sample.

getName()

Accessor to the object's name.

getOutputSample()

Accessor to the output sample.

getResult()

Get the results of the metamodel computation.

getWeights()

Return the weights of the input sample.

hasName()

Test if the object is named.

run()

Compute the response surface.

setDistribution(distribution)

Accessor to the joint probability density function of the physical input vector.

setName(name)

Accessor to the object's name.

Notes

Refer to Gaussian process regression (step 2) to get all the notations and the theoretical aspects. We only detail here the notions related to the class.

We suppose we have a sample (\vect{x}_k, \vect{y}_k)_{1 \leq k \leq \sampleSize} where \vect{y}_k = \model(\vect{x}_k) for all k, with \model:\Rset^{\inputDim} \mapsto \Rset^{\outputDim} the model.

The underlying Gaussian process approximation \vect{Y} can be fulfilled with two different ways:

  • Within the first constructor: we suppose that the Gaussian process approximation has already been calibrated using the class GaussianProcessFitter;

  • Within the second constructor: all the elements defining the Gaussian process approximation are specified separately: the data set, the covariance model and the trend function.

The objective of the GaussianProcessRegression is to condition the Gaussian process approximation \vect{Y} to the data set: thus, we make the Gaussian process approximation become interpolating over the dataset.

In all cases, no estimation of the underlying Gaussian process approximation \vect{Y} is performed. Refer to GaussianProcessFitter to get more details on the notation. The Gaussian process \vect{Y} is defined by:

\vect{Y}(\omega, \vect{x}) = \vect{\mu}(\vect{x}) + \vect{W}(\omega, \vect{x})

where \vect{\mu} : \Rset^\inputDim \rightarrow \Rset^outputDim is the trend function and \vect{W} is a Gaussian process of dimension \outputDim with zero mean and a specified covariance function.

The Gaussian Process Regression denoted by \vect{Z} is the Gaussian process \vect{Y} conditioned to the data set:

\vect{Z}(\omega, \vect{x}) = \vect{Y}(\omega, \vect{x})\, | \,  \cC

where \cC is the condition \vect{Y}(\omega, \vect{x}_k) = \vect{y}_k for 1 \leq k \leq \sampleSize.

Then, \vect{Z} is a Gaussian process, which mean and covariance function are defined in (4) and (5).

The Gaussian Process Regression metamodel \metaModel is defined by the mean of \vect{Z}. Its expression is detailed in (7).

In order to get services related to the conditional covariance, use the class GaussianProcessConditionalCovariance.

Examples

Create the model \model: \Rset \mapsto \Rset and the samples:

>>> import openturns as ot
>>> import openturns.experimental as otexp
>>> g = ot.SymbolicFunction(['x'],  ['x * sin(x)'])
>>> sampleX = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0], [7.0], [8.0]]
>>> sampleY = g(sampleX)

Create the algorithm:

>>> basis = ot.Basis([ot.SymbolicFunction(['x'], ['x']), ot.SymbolicFunction(['x'], ['x^2'])])
>>> covarianceModel = ot.SquaredExponential([1.0])
>>> covarianceModel.setActiveParameter([])
>>> fit_algo = otexp.GaussianProcessFitter(sampleX, sampleY, covarianceModel, basis)
>>> fit_algo.run()

Get the resulting interpolating metamodel \metaModel:

>>> fit_result = fit_algo.getResult()
>>> algo = otexp.GaussianProcessRegression(fit_result)
>>> algo.run()
>>> result = algo.getResult()
>>> metamodel = result.getMetaModel()
__init__(*args)
static BuildDistribution(inputSample)

Recover the distribution, with metamodel performance in mind.

For each marginal, find the best 1-d continuous parametric model else fallback to the use of a nonparametric one.

The selection is done as follow:

  • We start with a list of all parametric models (all factories)

  • For each model, we estimate its parameters if feasible.

  • We check then if model is valid, ie if its Kolmogorov score exceeds a threshold fixed in the MetaModelAlgorithm-PValueThreshold ResourceMap key. Default value is 5%

  • We sort all valid models and return the one with the optimal criterion.

For the last step, the criterion might be BIC, AIC or AICC. The specification of the criterion is done through the MetaModelAlgorithm-ModelSelectionCriterion ResourceMap key. Default value is fixed to BIC. Note that if there is no valid candidate, we estimate a non-parametric model (KernelSmoothing or Histogram). The MetaModelAlgorithm-NonParametricModel ResourceMap key allows selecting the preferred one. Default value is Histogram

One each marginal is estimated, we use the Spearman independence test on each component pair to decide whether an independent copula. In case of non independence, we rely on a NormalCopula.

Parameters:
sampleSample

Input sample.

Returns:
distributionDistribution

Input distribution.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getDistribution()

Accessor to the joint probability density function of the physical input vector.

Returns:
distributionDistribution

Joint probability density function of the physical input vector.

getInputSample()

Accessor to the input sample.

Returns:
inputSampleSample

Input sample of a model evaluated apart.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getOutputSample()

Accessor to the output sample.

Returns:
outputSampleSample

Output sample of a model evaluated apart.

getResult()

Get the results of the metamodel computation.

Returns:
resultGaussianProcessRegressionResult

Structure containing all the results obtained, created by the method run().

getWeights()

Return the weights of the input sample.

Returns:
weightssequence of float

The weights of the points in the input sample.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

run()

Compute the response surface.

Notes

It computes the Gaussian Process interpolating approximation and creates a GaussianProcessRegressionResult structure containing all the results.

setDistribution(distribution)

Accessor to the joint probability density function of the physical input vector.

Parameters:
distributionDistribution

Joint probability density function of the physical input vector.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

Examples using the class

Gaussian Process Regression vs KrigingAlgorithm

Gaussian Process Regression vs KrigingAlgorithm

Gaussian Process Regression: multiple input dimensions

Gaussian Process Regression: multiple input dimensions

Gaussian Process Regression : quick-start

Gaussian Process Regression : quick-start

Gaussian Process-based active learning for reliability

Gaussian Process-based active learning for reliability

Advanced Gaussian process regression

Advanced Gaussian process regression

Gaussian Process Regression: choose an arbitrary trend

Gaussian Process Regression: choose an arbitrary trend

Gaussian Process Regression: choose a polynomial trend on the beam model

Gaussian Process Regression: choose a polynomial trend on the beam model

Gaussian Process Regression : cantilever beam model

Gaussian Process Regression : cantilever beam model

Gaussian Process Regression: surrogate model with continuous and categorical variables

Gaussian Process Regression: surrogate model with continuous and categorical variables

Gaussian Process Regression: choose a polynomial trend

Gaussian Process Regression: choose a polynomial trend

Gaussian Process Regression: use an isotropic covariance kernel

Gaussian Process Regression: use an isotropic covariance kernel

Gaussian Process Regression : generate trajectories from the metamodel

Gaussian Process Regression : generate trajectories from the metamodel

Gaussian Process Regression: metamodel of the Branin-Hoo function

Gaussian Process Regression: metamodel of the Branin-Hoo function

Example of multi output Gaussian Process Regression on the fire satellite model

Example of multi output Gaussian Process Regression on the fire satellite model

Sequentially adding new points to a Gaussian Process metamodel

Sequentially adding new points to a Gaussian Process metamodel

Gaussian Process Regression: propagate uncertainties

Gaussian Process Regression: propagate uncertainties

EfficientGlobalOptimization examples

EfficientGlobalOptimization examples