KarhunenLoeveResult

class KarhunenLoeveResult(*args)

Result structure of a Karhunen Loeve algorithm.

Available constructors:

KarhunenLoeveResult(implementation)

KarhunenLoeveResult(covModel, s, lambda, modes, modesAsProcessSample, projection)

Parameters:

implementation : KarhunenLoeveResultImplementation

A specific implementation.

covModel : CovarianceModel

The covariance model.

s : float, positive

The minimal relative amplitude of the eigenvalues to consider in the decomposition wrt the maximum eigenvalue.

lambda : Point

The first eigenvalues of the Fredholm problem.

modes : Basis

The first modes of the Fredholm problem.

modesAsProcessSample : ProcessSample

The values of the modes on the mesh associated to the KarhunenLoeve algorithm.

projection : Matrix

The projection matrix.

Notes

Structure generally created by the method run() of a KarhunenLoeveAlgorithm and obtained thanks to the method getResult().

We consider C:\cD \times \cD \rightarrow  \cS^+_d(\Rset) a covariance function defined on \cD \in \Rset^n, continuous at \vect{0}.

We note (\lambda_k,  \vect{\varphi}_k)_{1 \leq k \leq K} the solutions of the Fredholm problem associated to C where K is the highest index K such that \lambda_K \geq s \lambda_1.

We note \vect{\lambda} the eigenvalues sequence and \vect{\varphi} the eigenfunctions sequence.

Then we define the linear projection function \pi_{ \vect{\lambda}, \vect{\varphi}} by:

(1)\pi_{\vect{\lambda}, \vect{\varphi}}: \left|
  \begin{array}{ccl}
    L^2(\cD, \Rset^d) & \rightarrow & \cS^{\Nset} \\
    f & \mapsto &\left(\dfrac{1}{\sqrt{\lambda_k}}\int_{\cD}f(\vect{t}) \vect{\varphi}_k(\vect{t})\, d\vect{t}\right)_{k \geq 1}
  \end{array}
\right.

where \cS^{\Nset}  = \left \{ (\zeta_k)_{k \geq 1} \in  \Rset^{\Nset} \, | \, \sum_{k=1}^{\infty}\lambda_k \zeta_k^2 < +\infty \right \}.

The integral of (1) can be discretized according to the chosen Karhunen Loeve algorithm: on the vertices of the domain \cD_N in the case of a P_1 algorithm, on the weighted experiment in the case of the quadrature method. Then function f can be reduced to its values on that discretization domain. Besides, we can restrict the sequences (\vect{\lambda}, \vect{\varphi}) to the K terms associated to the highest eigenvalues. Thus, following these discretizations, the function \pi_{\vect{\lambda}, \vect{\varphi}} has a matrical representation.

The inverse of \pi_{\vect{\lambda}, \vect{\varphi}} is the lift function defined by:

(2)\pi_{\vect{\lambda}, \vect{\varphi}}^{-1}: \left|
  \begin{array}{ccl}
     \cS^{\Nset} & \rightarrow & L^2(\cD, \Rset^d)\\
    (\xi_k)_{k \geq 1} & \mapsto & f(.) = \sum_{k \geq 1} \sqrt{\lambda_k}\xi_k \vect{\varphi}_k(.)
  \end{array}
\right.

If the function f(.) = X(\omega_0, .) where X is the centered process which covariance function is associated to the eigenvalues and eigenfunctions (\vect{\lambda}, \vect{\varphi}), then the getEigenValues method enables to obtain the K first eigenvalues of the Karhunen Loeve decomposition of X and the method getModes enables to get the associated modes.

Examples

>>> import openturns as ot
>>> N = 256
>>> mesh = ot.IntervalMesher([N - 1]).build(ot.Interval(-1, 1))
>>> covariance_X = ot.AbsoluteExponential([1])
>>> process_X = ot.GaussianProcess(covariance_X, mesh)
>>> threshold = 0.001
>>> algo_X = ot.KarhunenLoeveP1Algorithm(mesh, covariance_X, threshold)
>>> algo_X.run()
>>> result_X = algo_X.getResult()

Methods

getClassName() Accessor to the object’s name.
getCovarianceModel() Accessor to the covariance model.
getEigenValues() Accessor to the eigen values of the Karhunen Loeve decomposition.
getId() Accessor to the object’s id.
getImplementation(*args) Accessor to the underlying implementation.
getModes() Get the modes as functions.
getModesAsProcessSample() Accessor to the modes as a process sample.
getName() Accessor to the object’s name.
getProjectionMatrix() Accessor to the projection matrix.
getScaledModes() Get the modes as functions scaled by the square-root of the corresponding eigenvalue.
getScaledModesAsProcessSample() Accessor to the scaled modes as a process sample.
getThreshold() Accessor to the limit ratio on eigenvalues.
lift(coefficients) Lift the coefficients into a function.
liftAsField(coefficients) Lift the coefficients into a field.
project(*args) Project a function or a field on the eigen modes basis.
setName(name) Accessor to the object’s name.
__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getCovarianceModel()

Accessor to the covariance model.

Returns:

covModel : CovarianceModel

The covariance model.

getEigenValues()

Accessor to the eigen values of the Karhunen Loeve decomposition.

Returns:

eigenVal : Point

The most significant eigenvalues.

Notes

OpenTURNS truncates the sequence (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} at the highest index K such that \lambda_K \geq s \lambda_1 where s is the threshold fixed by the User.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getImplementation(*args)

Accessor to the underlying implementation.

Returns:

impl : Implementation

The implementation class.

getModes()

Get the modes as functions.

Returns:

modes : Basis

The truncated basis (\vect{\varphi}_k)_{1 \leq k \leq K}.

Notes

The basis is truncated to (\vect{\varphi}_k)_{1 \leq k \leq K} where K is fixed by the User through the s parameter.

getModesAsProcessSample()

Accessor to the modes as a process sample.

Returns:

modesAsProcessSample : ProcessSample

The values of each mode on a mesh whose vertices were used to discretize the Fredholm equation.

Notes

The modes (\vect{\varphi}_k)_{1 \leq k \leq K} are evaluated on the vertices of the mesh defining the process sample. The values of the i-th field are the values of the i-th mode on these vertices.

The mesh corresponds to the discretization points of the integral in (1).

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getProjectionMatrix()

Accessor to the projection matrix.

Returns:

projection : Matrix

The projection matrix associated to the discretized version of (1).

getScaledModes()

Get the modes as functions scaled by the square-root of the corresponding eigenvalue.

Returns:

modes : Basis

The truncated basis (\sqrt{\lambda_k}\vect{\varphi}_k)_{1 \leq k \leq K}.

Notes

The basis is truncated to (\sqrt{\lambda_k}\vect{\varphi}_k)_{1 \leq k \leq K} where K is fixed by the User through the s parameter.

getScaledModesAsProcessSample()

Accessor to the scaled modes as a process sample.

Returns:

modesAsProcessSample : ProcessSample

The values of each scaled mode on a mesh whose vertices were used to discretize the Fredholm equation.

Notes

The modes (\vect{\varphi}_k)_{1 \leq k \leq K} are evaluated on the vertices of the mesh defining the process sample. The values of the i-th field are the values of the i-th mode on these vertices.

The mesh corresponds to the discretization points of the integral in
(1).
getThreshold()

Accessor to the limit ratio on eigenvalues.

Returns:

s : float, positive

The minimal relative amplitude of the eigenvalues to consider in the decomposition wrt the maximum eigenvalue.

Notes

OpenTURNS truncates the sequence (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} at the highest index K such that \lambda_K \geq s \lambda_1.

lift(coefficients)

Lift the coefficients into a function.

Parameters:

coef : Point

The coefficients (\xi_1, \dots, \xi_K).

Returns:

modes : Function

The function f defined in (2).

Notes

The sum defining f is truncated to the first K terms, where K is fixed by the User through the s parameter.

liftAsField(coefficients)

Lift the coefficients into a field.

Parameters:

coef : Point

The coefficients (\xi_1, \dots, \xi_K).

Returns:

modes : Field

The function f defined in (2) evaluated on the mesh associated to the discretization of (1).

Notes

The sum defining f is truncated to the first K terms, where K is fixed by the User through the s parameter.

project(*args)

Project a function or a field on the eigen modes basis.

Available constructors:

project(function)

project(field)

Parameters:

function : Function

A function.

field : Field

A field.

Notes

The project method calculates the projection (1) on a field or a function where only the first K elements of the sequence are calculated. K is determined by the s parameter fixed by the User.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.