DiracCovarianceModel

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

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

Dirac covariance function.

Available constructors:

DiracCovarianceModel(spatialDim=1)

DiracCovarianceModel(spatialDim, amplitude)

DiracCovarianceModel(spatialDim, amplitude, spatialCorrelation)

DiracCovarianceModel(spatialDim, spatialCovariance)

Parameters:

spatialDim : int

Spatial dimension n. By default, equal to 1.

amplitude : sequence of positive floats

Amplitude of the process \vect{\sigma}\in \Rset^d. Its size is the dimension d of the process. By default, equal to [1].

spatialCorrelation : CorrelationMatrix

Correlation matrix \mat{R} \in \cS^+_d([-1, 1]). By default, Identity matrix.

spatialCovariance : CovarianceMatrix

Covariance matrix \mat{C}^{stat} \in \cS_d^+(\Rset). By default, Identity matrix.

See also

CovarianceModel

Notes

The Dirac covariance function is a stationary covariance function whith dimension d \geq 1.

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

The Dirac covariance function is defined by:

C(\vect{s}, \vect{t}) =  1_{\{\vect{s}=\vect{t}\}} \, \mbox{Diag}(\vect{\sigma}) \, \mat{R}\,  \mbox{Diag}(\vect{\sigma}), \quad \forall (\vect{s}, \vect{t}) \in \cD

where \mat{R} \in \cS_d^+([-1,1]) is the spatial correlation matrix. We can define the spatial covariance matrix \mat{C}^{stat} as:

\mat{C}^{stat} = \mbox{Diag}(\vect{\sigma}) \, mat{R}\,  \mbox{Diag}(\vect{\sigma})

The correlation function \rho writes:

\rho(\vect{s}, \vect{t}) = 1_{\{\vect{s}=\vect{t}\}}

Examples

Create a standard Dirac covariance function:

>>> import openturns as ot
>>> covModel = ot.DiracCovarianceModel(2)
>>> t = [0.1, 0.3]
>>> s = [0.1, 0.3]
>>> print(covModel(s, t))
[[ 1 ]]
>>> tau = [0.1, 0.3]
>>> print(covModel(tau))
[[ 0 ]]

Create a Dirac covariance function specifying the amplitude vector:

>>> covModel2 = ot.DiracCovarianceModel(2, [1.5, 2.5])

Create a Dirac covariance function specifying the amplitude vector and the correlation matrix:

>>> corrMat = ot.CorrelationMatrix(2)
>>> corrMat[1,0] = 0.1
>>> covModel3 =  ot.DiracCovarianceModel(2, [1.5, 2.5], corrMat)

Methods

__call__(*args) Evaluate the covariance function.
computeAsScalar(*args) Compute the covariance function for scalar model.
computeStandardRepresentative(*args) Compute the standard representative function of the covariance model.
discretize(*args) Discretize the covariance function on a given mesh.
discretizeAndFactorize(*args) Discretize and factorize the covariance function on a given mesh.
discretizeAndFactorizeHMatrix(*args) Discretize and factorize the covariance function on a given mesh.
discretizeHMatrix(*args) Discretize the covariance function on a given mesh using HMatrix result.
discretizeRow(vertices, p) (TODO)
draw(*args) Draw a specific component of the covariance model with spatial dimension 1.
getActiveParameter() Accessor to the active parameter set.
getAmplitude() Get the amplitude parameter \vect{\sigma} of the covariance function.
getClassName() Accessor to the object’s name.
getDimension() Get the dimension d of the covariance function.
getFullParameter() Get the full parameters of the covariance function.
getFullParameterDescription() Get the description full parameters of the covariance function.
getId() Accessor to the object’s id.
getMarginal(index) Get the ith marginal of the model.
getName() Accessor to the object’s name.
getNuggetFactor() Accessor to the nugget factor.
getParameter() Get the parameters of the covariance function.
getParameterDescription() Get the description of the covariance function parameters.
getScale() Get the scale parameter \vect{\theta} of the covariance function.
getShadowedId() Accessor to the object’s shadowed id.
getSpatialCorrelation() Get the spatial correlation matrix \mat{R} of the covariance function.
getSpatialDimension() Get the spatial dimension n of the covariance function.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
isDiagonal() Test whether the model is diagonal or not.
isStationary() Test whether the model is stationary or not.
parameterGradient(s, t) Compute the gradient according to the parameters.
partialGradient(s, t) Compute the gradient of the covariance function.
setActiveParameter(active) Accessor to the active parameter set.
setAmplitude(amplitude) Set the amplitude parameter \vect{\sigma} of the covariance function.
setFullParameter(parameter) Set the full parameters of the covariance function.
setName(name) Accessor to the object’s name.
setNuggetFactor(nuggetFactor) Set the nugget factor for the regularization.
setParameter(parameter) Set the parameters of the covariance function.
setScale(scale) Set the scale parameter \vect{\theta} of the covariance function.
setShadowedId(id) Accessor to the object’s shadowed id.
setSpatialCorrelation(correlation) Set the spatial correlation matrix \mat{R} of the covariance function.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)

x.__init__(…) initializes x; see help(type(x)) for signature

computeAsScalar(*args)

Compute the covariance function for scalar model.

Available usages:

computeAsScalar(s, t)

computeAsScalar(tau)

Parameters:

s, t : sequences of float

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

tau : sequence of float

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

Returns:

covariance : float

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(*args)

Compute the standard representative function of the covariance model.

Available usages:

computeStandardRepresentative(s, t)

computeStandardRepresentative(tau)

Parameters:

s, t : sequences of float

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

tau : float or sequence of float

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

Returns:

rho : float

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(*args)

Discretize the covariance function on a given mesh.

Parameters:

meshOrGrid : Mesh or RegularGrid

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

Returns:

covarianceMatrix : CovarianceMatrix

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(*args)

Discretize and factorize the covariance function on a given mesh.

Parameters:

meshOrGrid : Mesh or RegularGrid

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

Returns:

CholeskyMatrix : TriangularMatrix

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(*args)

Discretize and factorize the covariance function on a given mesh.

This uses HMatrix.

Parameters:

meshOrGrid : Mesh or RegularGrid

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

nuggetFactor: float

Nugget factor to be added to the discretized matrix

hmatParam : HMatrixParameters

Parameter values for the HMatrix

Returns:

HMatrix : HMatrix

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(*args)

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

Parameters:

meshOrGrid : Mesh or RegularGrid

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

nuggetFactor: float

Nugget factor to be added to the discretized matrix

hmatParam : HMatrixParameters

Parameter values for the HMatrix

Returns:

HMatrix : HMatrix

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(vertices, p)

(TODO)

draw(*args)

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

Parameters:

rowIndex : int, 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.

tMin : float

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

tMax : float

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

pointNumber : int, 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.

asStationary : bool

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.

correlationFlag : bool

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:

graph : Graph

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()

Accessor to the active parameter set.

Returns:

active : Indices

Indices of the active parameters.

getAmplitude()

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

Returns:

amplitude : Point

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

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getDimension()

Get the dimension d of the covariance function.

Returns:

d : int

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

getFullParameter()

Get the full parameters of the covariance function.

Returns:

parameter : Point

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()

Get the description full parameters of the covariance function.

Returns:

description : Description

Description of the full parameter of the covariance function.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getMarginal(index)

Get the ith marginal of the model.

Returns:

marginal : int

index of marginal of the model.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getNuggetFactor()

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:

nuggetFactor : float

Nugget factor used for the regularization of the discretized covariance matrix.

getParameter()

Get the parameters of the covariance function.

Returns:

parameters : Point

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()

Get the description of the covariance function parameters.

Returns:

descriptionParam : Description

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

getScale()

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

Returns:

scale : Point

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

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getSpatialCorrelation()

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

Returns:

spatialCorrelation : CorrelationMatrix

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

getSpatialDimension()

Get the spatial dimension n of the covariance function.

Returns:

spatialDimension : int

Spatial dimension n of the covariance function.

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.

isDiagonal()

Test whether the model is diagonal or not.

Returns:

isDiagonal : bool

True if the model is diagonal.

isStationary()

Test whether the model is stationary or not.

Returns:

isStationary : bool

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(s, t)

Compute the gradient according to the parameters.

Parameters:

s, t : sequences of float

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

Returns:

gradient : Matrix

Gradient of the function according to the parameters.

partialGradient(s, t)

Compute the gradient of the covariance function.

Parameters:

s, t : floats or sequences of float

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

Returns:

gradient : Matrix

Gradient of the covariance function.

setActiveParameter(active)

Accessor to the active parameter set.

Parameters:

active : sequence of int

Indices of the active parameters.

setAmplitude(amplitude)

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

Parameters:

amplitude : Point

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(parameter)

Set the full parameters of the covariance function.

Parameters:

parameter : Point

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(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setNuggetFactor(nuggetFactor)

Set the nugget factor for the regularization.

Acts on the discretized covariance matrix.

Parameters:

nuggetFactor : float

nugget factor to be used for the regularization of the discretized covariance matrix.

setParameter(parameter)

Set the parameters of the covariance function.

Parameters:

parameters : Point

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(scale)

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

Parameters:

scale : Point

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

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setSpatialCorrelation(correlation)

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

Parameters:

spatialCorrelation : CorrelationMatrix

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

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.