ProductCovarianceModel

(Source code, png, hires.png, pdf)

../../_images/openturns-ProductCovarianceModel-1.png
class ProductCovarianceModel(*args)

Univariate covariance function defined as a product.

Parameters
collsequence of CovarianceModel

Collection of covariance models (C_k)_{1 \leq k \leq K} of dimension d=1.

Notes

The product covariance function is a covariance function with dimension d=1. This allows to create a higher input dimension covariance model by combining models of smaller input dimensions. The input dimension of each model in the collection does not necessarily have to be equal to 1. It defines a covariance model from the given collection as follows.

We consider the scalar stochastic process X: \Omega \times\cD \rightarrow \Rset, where \omega \in \Omega is an event, \cD is a domain of \Rset^n.

The product covariance function writes:

C(\vect{s}, \vect{t}) = \prod_{k=1}^K  C_k(\vect{s}_k, \vect{t}_k), \quad \forall (\vect{s}, \vect{t}) \in \cD

where C_k : \cD_k \times \cD_k \rightarrow  \cS_d^+(\Rset) with \cD_k \in \Rset^{d_k}, \cD = \cD_1 \times \dots \times \cD_K, \cD_k \subset \Rset^{n_k} and n1 + \dots + n_K=n.

C also writes:

C(\vect{s}, \vect{t}) =  \sigma^2 \rho\left(\dfrac{\vect{s}}{\theta}, \dfrac{\vect{t}}{\theta}\right), \quad \forall (\vect{s}, \vect{t}) \in \cD

where the amplitude is:

\sigma= \prod_{k=1}^K \sigma_k

the scale is:

\Tr{\vect{\theta}}= \left(\Tr{\vect{\theta}}_1, \dots, \Tr{\vect{\theta}}_K \right)

and the correlation function \rho is:

\rho \left( \vect{s}, \vect{t} \right) = \prod_{k=1}^K \rho_k\left( \vect{s}_k, \vect{t}_k \right)

Examples

Create a product covariance function from two exponential functions, each one defined on \Rset \times \Rset \rightarrow \cS_1^+(\Rset):

>>> import openturns as ot
>>> amplitude = [1.0]
>>> scale1 = [4.0]
>>> scale2 = [4.0]
>>> cov1 = ot.ExponentialModel(scale1, amplitude)
>>> cov2 = ot.ExponentialModel(scale2, amplitude)
>>> covarianceModel = ot.ProductCovarianceModel([cov1, cov2])

Methods

__call__(self, \*args)

Evaluate the covariance function.

computeAsScalar(self, s, t)

Compute the covariance function for scalar model.

computeStandardRepresentative(self, \*args)

Compute the standard representative function of the covariance model.

discretize(self, \*args)

Discretize the covariance function on a given mesh.

discretizeAndFactorize(self, \*args)

Discretize and factorize the covariance function on a given mesh.

discretizeAndFactorizeHMatrix(self, \*args)

Discretize and factorize the covariance function on a given mesh.

discretizeHMatrix(self, \*args)

Discretize the covariance function on a given mesh using HMatrix result.

discretizeRow(self, vertices, p)

(TODO)

draw(self, \*args)

Draw a specific component of the covariance model with input dimension 1.

getActiveParameter(self)

Accessor to the active parameter set.

getAmplitude(self)

Get the amplitude parameter \vect{\sigma} of the covariance function.

getClassName(self)

Accessor to the object’s name.

getCollection(self)

Covariance model collection accessor.

getFullParameter(self)

Get the full parameters of the covariance function.

getFullParameterDescription(self)

Get the description full parameters of the covariance function.

getId(self)

Accessor to the object’s id.

getInputDimension(self)

Get the input dimension n of the covariance function.

getMarginal(self, index)

Get the ith marginal of the model.

getName(self)

Accessor to the object’s name.

getNuggetFactor(self)

Accessor to the nugget factor.

getOutputCorrelation(self)

Get the spatial correlation matrix \mat{R} of the covariance function.

getOutputDimension(self)

Get the dimension d of the covariance function.

getParameter(self)

Get the parameters of the covariance function.

getParameterDescription(self)

Get the description of the covariance function parameters.

getScale(self)

Get the scale parameter \vect{\theta} of the covariance function.

getShadowedId(self)

Accessor to the object’s shadowed id.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

isDiagonal(self)

Test whether the model is diagonal or not.

isStationary(self)

Test whether the model is stationary or not.

parameterGradient(self, s, t)

Compute the gradient according to the parameters.

partialGradient(self, s, t)

Compute the gradient of the covariance function.

setActiveParameter(self, active)

Accessor to the active parameter set.

setAmplitude(self, amplitude)

Set the amplitude parameter \vect{\sigma} of the covariance function.

setFullParameter(self, parameter)

Set the full parameters of the covariance function.

setName(self, name)

Accessor to the object’s name.

setNuggetFactor(self, nuggetFactor)

Set the nugget factor for the variance of the observation error.

setOutputCorrelation(self, correlation)

Set the spatial correlation matrix \mat{R} of the covariance function.

setParameter(self, parameter)

Set the parameters of the covariance function.

setScale(self, scale)

Set the scale parameter \vect{\theta} of the covariance function.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

computeAsScalar(self, s, t)

Compute the covariance function for scalar model.

Available usages:

computeAsScalar(s, t)

computeAsScalar(tau)

Parameters
s, tsequences of float

Multivariate index (\vect{s}, \vect{t}) \in \cD \times \cD

tausequence of float

Multivariate index \vect{\tau} \in \cD

Returns
covariancefloat

Covariance.

Notes

The method makes sense only if the dimension of the process is d=1. It evaluates C(\vect{s}, \vect{t}).

In the second usage, the covariance model must be stationary. Then we note C^{stat}(\vect{\tau}) for C(\vect{s}, \vect{s}+\vect{\tau}) as this quantity does not depend on \vect{s}.

computeStandardRepresentative(self, \*args)

Compute the standard representative function of the covariance model.

Available usages:

computeStandardRepresentative(s, t)

computeStandardRepresentative(tau)

Parameters
s, tsequences of float

Multivariate index (\vect{s}, \vect{t}) \in \cD \times \cD

taufloat or sequence of float

Multivariate index \vect{\tau} \in \cD

Returns
rhofloat

Correlation model \rho

Notes

It evaluates the scalar function \rho\left(\dfrac{\vect{s}}{\theta}, \dfrac{\vect{t}}{\theta}\right) or \rho\left(\dfrac{\vect{\tau}}{\theta}\right) if the model is stationary.

discretize(self, \*args)

Discretize the covariance function on a given mesh.

Parameters
meshOrGridMesh or RegularGrid

Mesh or time grid of size N associated with the process.

Returns
covarianceMatrixCovarianceMatrix

Covariance matrix \in \cS_{nd}^+(\Rset) (if the process is of dimension d

Notes

This method makes a discretization of the model on meshOrGrid composed of the vertices (\vect{t}_1, \dots, \vect{t}_{N-1}) and returns the covariance matrix:

\mat{C}_{1,\dots,k} = \left(
    \begin{array}{cccc}
    C(\vect{t}_1, \vect{t}_1) &C(\vect{t}_1, \vect{t}_2) & \dots & 
    C(\vect{t}_1, \vect{t}_{k}) \\
    \dots & C(\vect{t}_2, \vect{t}_2)  & \dots & 
    C(\vect{t}_2, \vect{t}_{k}) \\
    \dots & \dots & \dots & \dots \\
    \dots & \dots & \dots & C(\vect{t}_{k}, \vect{t}_{k})
    \end{array} \right)

discretizeAndFactorize(self, \*args)

Discretize and factorize the covariance function on a given mesh.

Parameters
meshOrGridMesh or RegularGrid

Mesh or time grid of size N associated with the process.

Returns
CholeskyMatrixTriangularMatrix

Cholesky factor of the covariance matrix \in \cM_{nd\times nd}(\Rset) (if the process is of dimension d).

Notes

This method makes a discretization of the model on meshOrGrid composed of the vertices (\vect{t}_1, \dots, \vect{t}_{N-1}) thanks to the discretize method and returns its Cholesky factor.

discretizeAndFactorizeHMatrix(self, \*args)

Discretize and factorize the covariance function on a given mesh.

This uses HMatrix.

Parameters
meshOrGridMesh or RegularGrid

Mesh or time grid of size N associated with the process.

hmatParamHMatrixParameters

Parameter values for the HMatrix

Returns
HMatrixHMatrix

Cholesk matrix \in \cS_{nd}^+(\Rset) (if the process is of dimension d), stored in hierarchical format (H-Matrix)

Notes

This method si similar to the discretizeAndFactorize method. This method requires that OpenTURNS has been compiled with the hmat library. The method is helpfull for very large parameters (Mesh, grid, Sample) as its compress data.

discretizeHMatrix(self, \*args)

Discretize the covariance function on a given mesh using HMatrix result.

Parameters
meshOrGridMesh or RegularGrid

Mesh or time grid of size N associated with the process.

hmatParamHMatrixParameters

Parameter values for the HMatrix

Returns
HMatrixHMatrix

Covariance matrix \in\cS_{nd}^+(\Rset) (if the process is of dimension d), stored in hierarchical format (H-Matrix)

Notes

This method si similar to the discretize method. This method requires that OpenTURNS has been compiled with the hmat library. The method is helpfull for very large parameters (Mesh, grid, Sample) as its compress data.

discretizeRow(self, vertices, p)

(TODO)

draw(self, \*args)

Draw a specific component of the covariance model with input dimension 1.

Parameters
rowIndexint, 0 \leq rowIndex < dimension

The row index of the component to draw. Default value is 0.

columnIndex: int, :math:`0 leq columnIndex < dimension`

The column index of the component to draw. Default value is 0.

tMinfloat

The lower bound of the range over which the model is plotted. Default value is CovarianceModel-DefaultTMin in ResourceMap.

tMaxfloat

The upper bound of the range over which the model is plotted. Default value is CovarianceModel-DefaultTMax in ResourceMap.

pointNumberint, pointNumber \geq 2

The discretization of the range [tMin,tMax] over which the model is plotted. Default value is CovarianceModel-DefaultPointNumber in class:~openturns.ResourceMap.

asStationarybool

Flag to tell if the model has to be plotted as a stationary model, ie as a function of the lag \tau=t-s if equals to True, or as a non-stationary model, ie as a function of (s,t) if equals to False. Default value is True.

correlationFlagbool

Flag to tell if the model has to be plotted as a correlation function if equals to True or as a covariance function if equals to False. Default value is False.

Returns
graphGraph

A graph containing a unique curve if asStationary=True and if the model is actually a stationary model, or containing the iso-values of the model if asStationary=False or if the model is nonstationary.

getActiveParameter(self)

Accessor to the active parameter set.

Returns
activeIndices

Indices of the active parameters.

getAmplitude(self)

Get the amplitude parameter \vect{\sigma} of the covariance function.

Returns
amplitudePoint

The amplitude parameter \vect{\sigma} \in \Rset^d of the covariance function.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getCollection(self)

Covariance model collection accessor.

Returns
collsequence of CovarianceModel
getFullParameter(self)

Get the full parameters of the covariance function.

Returns
parameterPoint

List the full parameter of the covariance function i.e. scale parameter \vect{\theta} \in \Rset^n, the the amplitude parameter \vect{\sigma} \in \Rset^d, the Spatial correlation parameter \mat{R} \in \cS_d^+([-1,1]); and potential other parameter depending on the model;

getFullParameterDescription(self)

Get the description full parameters of the covariance function.

Returns
descriptionDescription

Description of the full parameter of the covariance function.

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getInputDimension(self)

Get the input dimension n of the covariance function.

Returns
inputDimensionint

Spatial dimension n of the covariance function.

getMarginal(self, index)

Get the ith marginal of the model.

Returns
marginalint or sequence of int

index of marginal of the model.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getNuggetFactor(self)

Accessor to the nugget factor.

This parameter allows smooth predictions from noisy data. The nugget is added to the diagonal of the assumed training covariance (thanks to discretize) and acts as a Tikhonov regularization in the problem.

Returns
nuggetFactorfloat

Nugget factor used to model the observation error variance.

getOutputCorrelation(self)

Get the spatial correlation matrix \mat{R} of the covariance function.

Returns
spatialCorrelationCorrelationMatrix

Correlation matrix \mat{R} \in \cS_d^+(\Rset).

getOutputDimension(self)

Get the dimension d of the covariance function.

Returns
dint

Dimension d such that C : \cD \times \cD \mapsto \cS_d^+(\Rset). This is the dimension of the process X.

getParameter(self)

Get the parameters of the covariance function.

Returns
parametersPoint

List of the scale parameter \vect{\theta} \in \Rset^n and the amplitude parameter \vect{\sigma} \in \Rset^d of the covariance function.

The other specific parameters are not included.

getParameterDescription(self)

Get the description of the covariance function parameters.

Returns
descriptionParamDescription

Description of the components of the parameters obtained with the getParameter method..

getScale(self)

Get the scale parameter \vect{\theta} of the covariance function.

Returns
scalePoint

The scale parameter \vect{\theta} \in \Rset^n used in the covariance function.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

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

isDiagonal(self)

Test whether the model is diagonal or not.

Returns
isDiagonalbool

True if the model is diagonal.

isStationary(self)

Test whether the model is stationary or not.

Returns
isStationarybool

True if the model is stationary.

Notes

The covariance function C is stationary when it is invariant by translation:

\forall(\vect{s},\vect{t},\vect{h}) \in \cD \times \cD, & \, \quad
C(\vect{s}, \vect{s}+\vect{h}) = C(\vect{t}, \vect{t}+\vect{h})

We note C^{stat}(\vect{\tau}) for C(\vect{s}, \vect{s}+\vect{\tau}).

parameterGradient(self, s, t)

Compute the gradient according to the parameters.

Parameters
s, tsequences of float

Multivariate index (\vect{s}, \vect{t}) \in \cD \times \cD.

Returns
gradientMatrix

Gradient of the function according to the parameters.

partialGradient(self, s, t)

Compute the gradient of the covariance function.

Parameters
s, tfloats or sequences of float

Multivariate index (\vect{s}, \vect{t}) \in \cD \times \cD.

Returns
gradientMatrix

Gradient of the covariance function.

setActiveParameter(self, active)

Accessor to the active parameter set.

Parameters
activesequence of int

Indices of the active parameters.

setAmplitude(self, amplitude)

Set the amplitude parameter \vect{\sigma} of the covariance function.

Parameters
amplitudePoint

The amplitude parameter \vect{\sigma} \in \Rset^d to be used in the covariance function. Its size must be equal to the dimension of the covariance function.

setFullParameter(self, parameter)

Set the full parameters of the covariance function.

Parameters
parameterPoint

List the full parameter of the covariance function i.e. scale parameter \vect{\theta} \in \Rset^n, the the amplitude parameter \vect{\sigma} \in \Rset^d, the Spatial correlation parameter \mat{R} \in \cS_d^+([-1,1]); and potential other parameter depending on the model;

Must be at least of dimension n+\frac{d(d+1)}{2}.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setNuggetFactor(self, nuggetFactor)

Set the nugget factor for the variance of the observation error.

Acts on the discretized covariance matrix.

Parameters
nuggetFactorfloat

nugget factor to be used to model the variance of the observation error.

setOutputCorrelation(self, correlation)

Set the spatial correlation matrix \mat{R} of the covariance function.

Parameters
spatialCorrelationCorrelationMatrix

Correlation matrix \mat{R} \in \cS_d^+([-1,1]).

setParameter(self, parameter)

Set the parameters of the covariance function.

Parameters
parametersPoint

List of the scale parameter \vect{\theta} \in \Rset^n and the amplitude parameter \vect{\sigma} \in \Rset^d of the covariance function.

Must be of dimension n+d.

setScale(self, scale)

Set the scale parameter \vect{\theta} of the covariance function.

Parameters
scalePoint

The scale parameter \vect{\theta} \in \Rset^n to be used in the covariance function. Its size must be equal to the input dimension of the covariance function.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.