KarhunenLoeveAlgorithm

class KarhunenLoeveAlgorithm(*args)

Base class for Karhunen-Loeve algorithms.

Parameters:
covModelCovarianceModel

The covariance model.

sfloat, \geq0

The minimal relative amplitude of the eigenvalues to consider in the decomposition wrt the sum of the preceding eigenvalues. The default value is 0.

Notes

The Karhunen-Loeve decomposition enables to build some finite approximations of stochastic processes which are optimal with respect to the L^2 norm (see [sullivan2015] page 223).

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

The class KarhunenLoeveAlgorithm enables to determine the solutions of the second kind Fredholm equation associated to C, ie to find the (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} such that:

(1)\int_{\cD} \mat{C}(\vect{s},\vect{t}) \vect{\varphi}_k(\vect{t})\,  d\vect{t} = \lambda_k  \vect{\varphi}_k(\vect{s}) \quad \forall \vect{s} \in \cD

where (\lambda_k)_{k \geq 1} is a nonincreasing sequence of nonnegative values (the eigenvalues) and (\vect{\varphi}_k)_{k \geq 1} the associated sequence of eigenfunctions, normalized by \int_{\cD}\|\vect{\varphi}_k(\vect{s})\|^2\di{\vect{s}}=1. They form an Hilbertian basis of L^2(\cD, \Rset^d).

The Mercer theorem shows that the covariance function C is:

(2)\mat{C}(\vect{s},\vect{t}) = \sum_{k=1}^{+\infty} \lambda_k \vect{\varphi}_k(\vect{s}) \Tr{\vect{\varphi}}_k(\vect{t}) \quad \forall (\vect{s}, \vect{t}) \in \cD \times \cD

The threshold s is used in order to select the most significant eigenvalues, i.e. all the eigenvalues such that (the infinite sum on the right being replaced by the sum of all computed eigenvalues in numerical algorithms):

(3)K_s = \min \left\{ k \in \Nset \, | \, \sum_{i=1}^{k}{\lambda_i} \geq (1-s) \times \sum_{i \geq 1}^{+\infty} \lambda_i \right\}

The number of significant eigenvalues can also be specified directly by using setNbModes(). In this case, only n eigenvalues will be computed, and the number of selected eigenvalues will be:

(4)K = \min \left\{ n \, , \, K_s \right\}

with K_s as defined in (3).

Thus if threshold s is set to 0, the number of selected eigenvalues is set by setNbModes().

To solve (1), we use the functional basis (\theta_p)_{1 \leq p \leq P} of L^2(\cD, \Rset) with P elements defined on \cD. We search the solutions of type:

\tilde{\vect{\varphi}}_k(\vect{t})=\sum_{p=1}^{P} \vect{\phi}_{pk}\theta_p(\vect{t})

where \vect{\phi}_{pk} \in \Rset^d. We note:

\begin{align*}
    \vect{\Phi}_k =
    \left(
      \begin{array}{l}
        \vect{\phi}_{1k} \\
        \dots \\
        \vect{\phi}_{Pk}
      \end{array}
    \right) \in \Rset^{Pd}
 \end{align*}

and \mat{\vect{\Phi}} = (\vect{\Phi}_1\, |\, \dots \, | \vect{\Phi}_K) the matrix of the K first modes of the Karhunen-Loeve decomposition.

The approximated Fredholm problem is for all k \geq 1:

\int_{\cD} \mat{C}(\vect{s},\vect{t}) \tilde{\vect{\varphi}}_k(\vect{t})\,  d\vect{t} = \lambda_k   \tilde{\vect{\varphi}}_k(\vect{s}) \quad  \forall \vect{s} \in \cD

which enables to define the residual function \vect{r}: \cD \rightarrow \Rset^d defined by

(5)\vect{r}(\vect{s}) = \int_{\cD} \mat{C}(\vect{s},\vect{t}) \tilde{\vect{\varphi}}_k(\vect{t})\,  d\vect{t} - \lambda_k  \tilde{\vect{\varphi}}_k(\vect{s})

The Fredholm problem writes:

(6)\vect{r}(\vect{s}) = \vect{0} \quad \forall \vect{s} \in \cD

which is solved either by the Galerkin approach or the collocation approach.

The integrals in (5) can be evaluated with:

Methods

getClassName()

Accessor to the object's name.

getCovarianceModel()

Accessor to the covariance model.

getId()

Accessor to the object's id.

getImplementation()

Accessor to the underlying implementation.

getName()

Accessor to the object's name.

getNbModes()

Accessor to number of modes to compute.

getResult()

Get the result structure.

getThreshold()

Accessor to the threshold used to select the most significant eigenmodes.

run()

Launch the algorithm.

setCovarianceModel(covariance)

Accessor to the covariance model.

setName(name)

Accessor to the object's name.

setNbModes(nbModes)

Accessor to the maximum number of modes to compute.

setThreshold(threshold)

Accessor to the limit ratio on eigenvalues.

__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

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

getCovarianceModel()

Accessor to the covariance model.

Returns:
covModelCovarianceModel

The covariance model.

getId()

Accessor to the object’s id.

Returns:
idint

Internal unique identifier.

getImplementation()

Accessor to the underlying implementation.

Returns:
implImplementation

A copy of the underlying implementation object.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getNbModes()

Accessor to number of modes to compute.

Returns:
nint

The maximum number of modes to compute. The actual number of modes also depends on the threshold criterion.

getResult()

Get the result structure.

Returns:
resKLKarhunenLoeveResult

The structure containing all the results of the Fredholm problem.

Notes

The structure contains all the results of the Fredholm problem.

getThreshold()

Accessor to the threshold used to select the most significant eigenmodes.

Returns:
sfloat, positive

The threshold s.

Notes

OpenTURNS truncates the sequence (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} at the index K defined in (3).

run()

Launch the algorithm.

Notes

It launches the algorithm and creates a KarhunenLoeveResult, structure containing all the results.

setCovarianceModel(covariance)

Accessor to the covariance model.

Parameters:
covModelCovarianceModel

The covariance model.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setNbModes(nbModes)

Accessor to the maximum number of modes to compute.

Parameters:
nint

The maximum number of modes to compute. The actual number of modes also depends on the threshold criterion.

setThreshold(threshold)

Accessor to the limit ratio on eigenvalues.

Parameters:
sfloat, \geq 0

The threshold s defined in (3).