FixedStrategy

class FixedStrategy(*args)

Fixed truncation strategy.

Available constructors:

FixedStrategy(orthogonalBasis, dimension)

Parameters
orthogonalBasisOrthogonalBasis

An OrthogonalBasis.

dimensionpositive int

Number of terms of the basis.

Notes

The so-called fixed strategy simply consists in retaining the first P elements of the PC basis, the latter being ordered according to a given EnumerateFunction (hyperbolic or not). The retained set is built in a single pass. The truncated PC expansion is given by:

\hat{h} (\uX) = \sum_{j=0}^{P-1} \vect{a}_j \Psi_j (\uX)

In case of a LinearEnumerateFunction, for a given natural integer p, a usual choice is to set P equals to:

P = \binom{n_X + p}{p} = \frac{(n_X + p)!}{n_X!\,p!}

This way the set of retained basis functions \{\Psi_j, j = 0, \ldots, P-1\} gathers all the polynomials with total degree not greater than p. The number of terms P grows polynomially both in n_X and p though, which may lead to difficulties in terms of computational efficiency and memory requirements when dealing with high-dimensional problems.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> # Define the model
>>> inputDim = 1
>>> model = ot.SymbolicFunction(['x'], ['x*sin(x)'])
>>> # Create the input distribution
>>> distribution = ot.ComposedDistribution([ot.Uniform()]*inputDim)
>>> # Construction of the multivariate orthonormal basis
>>> polyColl = [0.0]*inputDim
>>> for i in range(distribution.getDimension()):
...     polyColl[i] = ot.StandardDistributionPolynomialFactory(distribution.getMarginal(i))
>>> enumerateFunction = ot.LinearEnumerateFunction(inputDim)
>>> productBasis = ot.OrthogonalProductPolynomialFactory(polyColl, enumerateFunction)
>>> # Truncature strategy of the multivariate orthonormal basis
>>> # We choose all the polynomials of degree <= 4
>>> degree = 4
>>> indexMax = enumerateFunction.getStrataCumulatedCardinal(degree)
>>> print(indexMax)
5
>>> # We keep all the polynomials of degree <= 4
>>> # which corresponds to the 5 first ones
>>> adaptiveStrategy = ot.FixedStrategy(productBasis, indexMax)

Methods

computeInitialBasis(self)

Compute initial basis for the approximation.

getBasis(self)

Accessor to the underlying orthogonal basis.

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getMaximumDimension(self)

Accessor to the maximum dimension of the orthogonal basis.

getName(self)

Accessor to the object’s name.

getPsi(self)

Accessor to the orthogonal polynomials of the basis.

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.

setMaximumDimension(self, maximumDimension)

Accessor to the maximum dimension of the orthogonal basis.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

updateBasis(self, alpha_k, residual, …)

Update the basis for the next iteration of approximation.

__init__(self, \*args)

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

computeInitialBasis(self)

Compute initial basis for the approximation.

See also

getPsi
getBasis(self)

Accessor to the underlying orthogonal basis.

Returns
basisOrthogonalBasis

Orthogonal basis of which the adaptive strategy is based.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getMaximumDimension(self)

Accessor to the maximum dimension of the orthogonal basis.

Returns
Pinteger

Maximum dimension of the truncated basis.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getPsi(self)

Accessor to the orthogonal polynomials of the basis.

Returns
polynomialslist of polynomials

Sequence of P analytical polynomials.

Notes

The method computeInitialBasis() must be applied first.

Examples

>>> import openturns as ot
>>> productBasis = ot.OrthogonalProductPolynomialFactory([ot.HermiteFactory()])
>>> adaptiveStrategy = ot.FixedStrategy(productBasis, 3)
>>> adaptiveStrategy.computeInitialBasis()
>>> print(adaptiveStrategy.getPsi())
[1,x0,-0.707107 + 0.707107 * x0^2]
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.

setMaximumDimension(self, maximumDimension)

Accessor to the maximum dimension of the orthogonal basis.

Parameters
Pinteger

Maximum dimension of the truncated basis.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

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.

updateBasis(self, alpha_k, residual, relativeError)

Update the basis for the next iteration of approximation.

Notes

No changes are made to the basis in the fixed strategy.