KarhunenLoeveQuadratureAlgorithm

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

../../_images/KarhunenLoeveQuadratureAlgorithm.png
class KarhunenLoeveQuadratureAlgorithm(*args)

Computation of Karhunen-Loeve decomposition using Quadrature approximation.

Available constructors:

KarhunenLoeveQuadratureAlgorithm(domain, covariance, experiment, basis, basisSize, mustScale, threshold)

KarhunenLoeveQuadratureAlgorithm(domain, covariance, marginalDegree, threshold)

Parameters:

domain : Domain

The domain on which the covariance model and the Karhunen-Loeve eigenfunctions (modes) are discretized.

covariance : CovarianceModel

The covariance function to decompose.

experiment : WeightedExperiment

The points and weights used in the quadrature approximation.

basis : Basis

The basis in wich the eigenfunctions are projected.

basisSize : integer

The number of elements of the basis considered.

marginalDegree : integer

The maximum degree to take into account in the tensorized Legendre basis.

mustScale : boolean

Flag to tell if the bounding box of the weighted experiment and the domain have to be maped or not.

threshold : float

The minimal relative amplitude of the eigenvalues to consider in the decomposition wrt the maximum eigenvalue. Default value is 0.

Notes

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 KarhunenLoeveQuadratureAlgorithm 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 constitue an hilbertian basis of L^2(\cD, \Rset^d).

OpenTURNS uses the threshold s in order to select the most significant eigenvalues, ie all the eigenvalues such that \lambda_k \geq s \lambda_1.

The Karhunen-Loeve Quadrature approximation consists in replacing the integral of (1) by a quadrature approximation: if (\omega_\ell, \vect{\xi}_\ell)_{1 \leq \ell \leq L} is the weighted experiment (see WeightedExperiment) associated to the measure \mu, then for all functions measurable wrt \mu, we have:

\int_{\Rset^n} f(\vect{x}) \mu(\vect{x})\, d\vect{x} \simeq \sum_{\ell=1}^{\ell=L} \omega_\ell f(\vect{\xi}_\ell)

If we note \eta_{\ell}=\omega_{\ell}\dfrac{1_{\cD}(\vect{\xi}_{\ell})}{\mu(\vect{\xi}_{\ell})}, we build a more general quadrature approximation (\eta_\ell, \xi_\ell)_{1 \leq l \leq L} such that:

\int_{\cD} f(\vect{t})  \, d\vect{t} \simeq \sum_{\ell=1}^L \eta_\ell f(\vect{\xi}_\ell)

where only the points \vect{\xi}_\ell \in \cD are considered.

The second constructor is a short-hand to the first one, where basis is the tensorized Legendre basis, see OrthogonalProductPolynomialFactory and LegendreFactory, experiment is a tensorized Gauss-Legendre quadrature, see GaussProductExperiment, basisSize is equal to marginalDegree to the power the dimension of domain and mustScale is set to True.

Examples

Discretize the domain \cD and create a covariance model:

>>> import openturns as ot
>>> domain = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
>>> threshold = 0.01
>>> model = ot.AbsoluteExponential([1.0]*2)

Give the basis used to decompose the eigenfunctions:

here, the 10 first Legendre polynomials family:

>>> basis = ot.OrthogonalProductPolynomialFactory([ot.LegendreFactory()]*2)
>>> basisSize = 10

Create the weighted experiment of the quadrature approximation:

here, a Monte Carlo experiment from the measure orthogonal wrt the Legendre polynomials family:

>>> experiment = ot.MonteCarloExperiment(basis.getMeasure(), 1000)

Create the Karhunen-Loeve Quadrature algorithm:

>>> algorithm = ot.KarhunenLoeveQuadratureAlgorithm(domain, model, experiment, basis, basisSize, True, threshold)

Methods

getBasis()
getBasisSize()
getClassName() Accessor to the object’s name.
getCovarianceModel() Accessor to the covariance model.
getDomain() Accessor to the domain.
getExperiment()
getId() Accessor to the object’s id.
getMustScale()
getName() Accessor to the object’s name.
getResult() Get the result structure.
getShadowedId() Accessor to the object’s shadowed id.
getThreshold() Accessor to the limit ratio on eigenvalues.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
run() Computation of the eigenvalues and eigenfunctions values at the quadrature points.
setCovarianceModel(covariance) Accessor to the covariance model.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setThreshold(threshold) Accessor to the limit ratio on eigenvalues.
setVisibility(visible) Accessor to the object’s visibility state.
__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.

getDomain()

Accessor to the domain.

Returns:

domain : Domain

The domain \cD_N that discretizes the domin \cD.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getResult()

Get the result structure.

Returns:

resKL : KarhunenLoeveResult

The structure containing all the results of the Fredholm problem.

Notes

The structure contains all the results of the Fredholm problem.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

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.

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.

run()

Computation of the eigenvalues and eigenfunctions values at the quadrature points.

Examples

>>> import openturns as ot
>>> domain = ot.Interval([-1.0]*2, [1.0]*2)
>>> threshold = 0.01
>>> model = ot.AbsoluteExponential([1.0]*2)
>>> basis = ot.OrthogonalProductPolynomialFactory([ot.LegendreFactory()]*2)
>>> experiment = ot.MonteCarloExperiment(basis.getMeasure(), 1000)
>>> algorithm = ot.KarhunenLoeveQuadratureAlgorithm(domain, model, experiment, basis, 10, True, threshold)
>>> algorithm.run()
>>> result = algorithm.getResult()
setCovarianceModel(covariance)

Accessor to the covariance model.

Parameters:

covModel : CovarianceModel

The covariance model.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setThreshold(threshold)

Accessor to the limit ratio on eigenvalues.

Parameters:

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.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.