KrigingResult

class KrigingResult(*args)

Kriging result.

Available constructors:

KrigingResult(inputSample, outputSample, metaModel, residuals, relativeErrors, basis, trendCoefficients, covarianceModel, covarianceCoefficients)

KrigingResult(inputSample, outputSample, metaModel, residuals, relativeErrors, basis, trendCoefficients, covarianceModel, covarianceCoefficients, covarianceCholeskyFactor, covarianceHMatrix)

Parameters:

inputSample, outputSample : 2-d sequence of float

The samples (\vect{x}_k)_{1 \leq k \leq N} \in \Rset^d and (\vect{y}_k)_{1 \leq k \leq N}\in \Rset^p.

metaModel : Function

The meta model: \tilde{\cM}: \Rset^d \rightarrow \Rset^p, defined in (3).

residuals : Point

The residual errors.

relativeErrors : Point

The relative errors.

basis : collection of Basis

Collection of the p functional basis: (\varphi_j^l)_{1 \leq j \leq n_l} for each l \in [1, p] with \varphi_j^l: \Rset^d \rightarrow \Rset. Its size must be equal to zero if the trend is not estimated.

trendCoefficients : collection of Point

The trend coeffient vectors (\vect{\alpha}^1, \dots, \vect{\alpha}^p).

covarianceModel : CovarianceModel

Covariance function of the normal process.

covarianceCoefficients : 2-d sequence of float

The \vect{\gamma} defined in (2).

covarianceCholeskyFactor : TriangularMatrix

The Cholesky factor \mat{L} of \mat{C}.

covarianceHMatrix : HMatrix

The hmat implementation of \mat{L}.

Notes

The Kriging meta model \tilde{\cM} is defined by:

(1)\tilde{\cM}(\vect{x}) =  \vect{\mu}(\vect{x}) + \Expect{\vect{Y}(\omega, \vect{x})\,| \,\cC}

where \cC is the condition \vect{Y}(\omega, \vect{x}_k) = \vect{y}_k for each k \in [1, N].

Equation (1) writes:

\tilde{\cM}(\vect{x}) = \vect{\mu}(\vect{x}) + \Cov{\vect{Y}(\omega, \vect{x}), (\vect{Y}(\omega,\vect{x}_1),\dots,\vect{Y}(\omega, \vect{x}_N))}\vect{\gamma}

where

\Cov{\vect{Y}(\omega, \vect{x}), (\vect{Y}(\omega, \vect{x}_1),\dots,\vect{Y}(\omega, \vect{x}_N))} = \left(\mat{C}(\vect{x},\vect{x}_1)|\dots|\mat{C}(\vect{x},\vect{x}_N)\right)\in \cM_{p,NP}(\Rset)

and

(2)\vect{\gamma} = \mat{C}^{-1}(\vect{y}-\vect{m})

At the end, the meta model writes:

(3)\tilde{\cM}(\vect{x}) = \vect{\mu}(\vect{x}) + \sum_{i=1}^N \gamma_i  \mat{C}(\vect{x},\vect{x}_i)

Examples

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

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

Create the algorithm:

>>> basis = ot.Basis([ot.SymbolicFunction(['x'], ['x']), ot.SymbolicFunction(['x'], ['x^2'])])
>>> covarianceModel = ot.GeneralizedExponential([2.0], 2.0)
>>> algoKriging = ot.KrigingAlgorithm(sampleX, sampleY, covarianceModel, basis)
>>> algoKriging.run()

Get the result:

>>> resKriging = algoKriging.getResult()

Get the meta model:

>>> metaModel = resKriging.getMetaModel()

Methods

__call__(*args)
getBasisCollection() Accessor to the collection of basis.
getClassName() Accessor to the object’s name.
getConditionalCovariance(*args) Compute the expected covariance of the Gaussian process on a point (or several points).
getConditionalMean(*args) Compute the expected mean of the Gaussian process on a point or a sample of points.
getCovarianceCoefficients() Accessor to the covariance coefficients.
getCovarianceModel() Accessor to the covariance model.
getId() Accessor to the object’s id.
getInputSample() Accessor to the input sample.
getMetaModel() Accessor to the metamodel.
getModel() Accessor to the model.
getName() Accessor to the object’s name.
getOutputSample() Accessor to the output sample.
getRelativeErrors() Accessor to the relative errors.
getResiduals() Accessor to the residuals.
getShadowedId() Accessor to the object’s shadowed id.
getTransformation() Accessor to the normalizing transformation.
getTrendCoefficients() Accessor to the trend coefficients.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setMetaModel(metaModel) Accessor to the metamodel.
setModel(model) Accessor to the model.
setName(name) Accessor to the object’s name.
setRelativeErrors(relativeErrors) Accessor to the relative errors.
setResiduals(residuals) Accessor to the residuals.
setShadowedId(id) Accessor to the object’s shadowed id.
setTransformation(transformation) Accessor to the normalizing transformation.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
getBasisCollection()

Accessor to the collection of basis.

Returns:

basisCollection : collection of Basis

Collection of the p function basis: (\varphi_j^l)_{1 \leq j \leq n_l} for each l \in [1, p] with \varphi_j^l: \Rset^d \rightarrow \Rset.

Notes

If the trend is not estimated, the collection is empty.

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getConditionalCovariance(*args)

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

Available usages:

getConditionalCovariance(x)

getConditionalCovariance(sampleX)

Parameters:

x : sequence of float

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

sampleX : 2-d sequence of float

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

Returns:

condCov : CovarianceMatrix

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

Or the conditional covariance matrix at the sample (\vect{\xi}_1, \dots, \vect{\xi}_M):

\left(
  \begin{array}{lcl}
     \Sigma_{11} & \dots & \Sigma_{1M} \\
    \dots  \\
    \Sigma_{M1} & \dots & \Sigma_{MM}
   \end{array}
 \right)

where \Sigma_{ij} = \Cov{\vect{Y}(\omega, \vect{\xi}_i), \vect{Y}(\omega, \vect{\xi}_j)\, | \,  \cC}.

getConditionalMean(*args)

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

Available usages:

getConditionalMean(x)

getConditionalMean(sampleX)

Parameters:

x : sequence of float

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

sampleX : 2-d sequence of float

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

Returns:

condMean : Point

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

Or the conditional mean matrix at the sample (\vect{\xi}_1, \dots, \vect{\xi}_M):

\left(
  \begin{array}{l}
     \Expect{\vect{Y}(\omega, \vect{\xi}_1)\, | \,  \cC}\\
    \dots  \\
    \Expect{\vect{Y}(\omega, \vect{\xi}_M)\, | \,  \cC}
   \end{array}
 \right)

getCovarianceCoefficients()

Accessor to the covariance coefficients.

Returns:

covCoeff : Sample

The \vect{\gamma} defined in (2).

getCovarianceModel()

Accessor to the covariance model.

Returns:

covModel : CovarianceModel

The covariance model of the Normal process W with its optimized parameters.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getInputSample()

Accessor to the input sample.

Returns:

inputSample : Sample

The input sample.

getMetaModel()

Accessor to the metamodel.

Returns:

metaModel : Function

Metamodel.

getModel()

Accessor to the model.

Returns:

model : Function

Physical model approximated by a metamodel.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getOutputSample()

Accessor to the output sample.

Returns:

outputSample : Sample

The output sample.

getRelativeErrors()

Accessor to the relative errors.

Returns:

relativeErrors : Point

The relative errors defined as follows for each output of the model: \displaystyle \frac{\sum_{i=1}^N (y_i - \hat{y_i})^2}{N \Var{\vect{Y}}} with \vect{Y} the vector of the N model’s values y_i and \hat{y_i} the metamodel’s values.

getResiduals()

Accessor to the residuals.

Returns:

residuals : Point

The residual values defined as follows for each output of the model: \displaystyle \frac{\sqrt{\sum_{i=1}^N (y_i - \hat{y_i})^2}}{N} with y_i the N model’s values and \hat{y_i} the metamodel’s values.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getTransformation()

Accessor to the normalizing transformation.

Returns:

transformation : Function

The transformation T that normalizes the input sample.

getTrendCoefficients()

Accessor to the trend coefficients.

Returns:

trendCoef : collection of Point

The trend coefficients vectors (\vect{\alpha}^1, \dots, \vect{\alpha}^p)

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

True if the name is not empty and not the default one.

setMetaModel(metaModel)

Accessor to the metamodel.

Parameters:

metaModel : Function

Metamodel.

setModel(model)

Accessor to the model.

Parameters:

model : Function

Physical model approximated by a metamodel.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setRelativeErrors(relativeErrors)

Accessor to the relative errors.

Parameters:

relativeErrors : sequence of float

The relative errors defined as follows for each output of the model: \displaystyle \frac{\sum_{i=1}^N (y_i - \hat{y_i})^2}{N \Var{\vect{Y}}} with \vect{Y} the vector of the N model’s values y_i and \hat{y_i} the metamodel’s values.

setResiduals(residuals)

Accessor to the residuals.

Parameters:

residuals : sequence of float

The residual values defined as follows for each output of the model: \displaystyle \frac{\sqrt{\sum_{i=1}^N (y_i - \hat{y_i})^2}}{N} with y_i the N model’s values and \hat{y_i} the metamodel’s values.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setTransformation(transformation)

Accessor to the normalizing transformation.

Parameters:

transformation : Function

The transformation T that normalizes the input sample.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.