GaussianProcessConditionalCovariance

class GaussianProcessConditionalCovariance(*args)

Conditional covariance post processing of a Gaussian Process Regression result.

Warning

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

Parameters:
gprResultGaussianProcessRegressionResult

The result class built by GaussianProcessRegression.

Methods

getClassName()

Accessor to the object's name.

getConditionalCovariance(*args)

Compute the conditional covariance of the Gaussian process on a point (or several points).

getConditionalMarginalVariance(*args)

Compute the conditional variance of the Gaussian process on a point (or several points).

getConditionalMean(*args)

Compute the conditional mean of the Gaussian process on a point or a sample of points.

getDiagonalCovariance(xi)

Compute the diagonal conditional covariance of the Gaussian process on a point.

getDiagonalCovarianceCollection(xi)

Compute the conditional covariance of the Gaussian process on a sample.

getName()

Accessor to the object's name.

hasName()

Test if the object is named.

setName(name)

Accessor to the object's name.

Notes

Refer to Gaussian process regression (step 3) 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 Gaussian process approximation \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 defined by:

\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.

The class provides services related to the conditional covariance of the Gaussian process regression \vect{Z}.

Examples

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

>>> import openturns as ot
>>> from openturns.experimental import GaussianProcessRegression
>>> from openturns.experimental import GaussianProcessConditionalCovariance
>>> trend = ot.SymbolicFunction(['x'],  ['1'])
>>> sampleX = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
>>> sampleY = trend(sampleX)

Create the algorithm:

>>> covarianceModel = ot.SquaredExponential([1.0])
>>> covarianceModel.setActiveParameter([])
>>> algo = GaussianProcessRegression(sampleX, sampleY, covarianceModel, trend)
>>> algo.run()
>>> result = algo.getResult()
>>> condCov = GaussianProcessConditionalCovariance(result)
>>> c = condCov([1.1])
__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

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

getConditionalCovariance(*args)

Compute the conditional covariance of the Gaussian process on a point (or several points).

Parameters:
xsequence of float

The point \vect{x} where the conditional covariance of the output has to be evaluated.

sampleX2-d sequence of float

The sample (\vect{\xi}_1, \dots, \vect{\xi}_N) where the conditional covariance of the output has to be evaluated (N can be equal to 1).

Returns:
condCovCovarianceMatrix

The conditional covariance of the Gaussian process regression \vect{Z} defined in (2) at point \vect{x} is defined in (5). When computed on the sample (\vect{\xi}_1, \dots, \vect{\xi}_N), the covariance matrix is defined in (6).

getConditionalMarginalVariance(*args)

Compute the conditional variance of the Gaussian process on a point (or several points).

Parameters:
xsequence of float

The point \vect{x} where the conditional variance of the output has to be evaluated.

sampleX2-d sequence of float

The sample (\vect{\xi}_1, \dots, \vect{\xi}_N) where the conditional variance of the output has to be evaluated (N can be equal to 1).

marginalIndexint

Marginal of interest (for multiple outputs).

Default value is 0 (first component).

marginalIndicessequence of int

Marginals of interest (for multiple outputs).

Returns:
varfloat

The variance of the specified marginal of the Gaussian process regression \vect{Z} defined in (2) at the specified point.

varPointsequence of float

The marginal variances of each marginal of interest computed at each given point.

Notes

If only one marginal k of interest and one point \vect{x} have been specified, the method returns \Var{Z_k(\omega, \vect{x})} where \vect{Z} is the Gaussian process regression defined in (2).

If several marginal of interest (k_1, \dots, k_M) or several points (\vect{\xi}_1,
\dots, \vect{\xi}_N) have been specified, the method returns the concatenation of sequence of variances (\Var{Z_{k_1}(\omega, \vect{\xi}_j)}, \dots, \Var{Z_{k_M}(\omega, \vect{\xi}_j)}) for each 1 \leq j \leq N.

getConditionalMean(*args)

Compute the conditional mean of the Gaussian process on a point or a sample of points.

Parameters:
xsequence of float

The point \vect{x} where the conditional mean of the output has to be evaluated.

sampleX2-d sequence of float

The sample (\vect{\xi}_1, \dots, \vect{\xi}_N) where the conditional mean of the output has to be evaluated (N can be equal to 1).

Returns:
condMeanPoint

The conditional mean the Gaussian process regression \vect{Z} defined in (2) at point \vect{x} or on the sample (\vect{\xi}_1, \dots, \vect{\xi}_N):

\left(
  \begin{array}{l}
    \Expect{\vect{Z}(\omega, \vect{\xi}_1)}\\
    \dots  \\
    \Expect{\vect{Z}(\omega, \vect{\xi}_N)}
  \end{array}
\right)

This vector is in \Rset^{N \times \outputDim}.

getDiagonalCovariance(xi)

Compute the diagonal conditional covariance of the Gaussian process on a point.

Parameters:
xsequence of float

The point \vect{x} where the conditional marginal covariance of the output has to be evaluated.

Returns:
condCovCovarianceMatrix

The conditional covariance \Cov{\vect{Y}(\omega, \vect{x})\, | \,  \cC} at point \vect{x}.

getDiagonalCovarianceCollection(xi)

Compute the conditional covariance of the Gaussian process on a sample.

Parameters:
sampleX2-d sequence of float

The sample (\vect{\xi}_1, \dots, \vect{\xi}_N) where the conditional marginal covariance of the output has to be evaluated (N can be equal to 1).

Returns:
condCovCovarianceMatrixCollection

The collection of conditional covariance matrices \Cov{\vect{Z}(\omega, \vect{\xi}_i)}
= \mat{\Sigma_{ii}} for 1 \leq i \leq N defined in (6).

Notes

Each element of the collection corresponds to the conditional covariance with respect to the input learning set (e.g. a pointwise evaluation of the getDiagonalCovariance). The returned collection is of size N and contains matrices in \cM_{\outputDim, \outputDim}(\Rset).

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

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 : 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: 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: metamodel of the Branin-Hoo function

Gaussian Process Regression: metamodel of the Branin-Hoo function

Sequentially adding new points to a Gaussian Process metamodel

Sequentially adding new points to a Gaussian Process metamodel