HyperbolicAnisotropicEnumerateFunction

class HyperbolicAnisotropicEnumerateFunction(*args)

Hyperbolic and anisotropic enumerate function.

Available constructors:

HyperbolicAnisotropicEnumerateFunction(dim)

HyperbolicAnisotropicEnumerateFunction(dim, q)

HyperbolicAnisotropicEnumerateFunction(weight)

HyperbolicAnisotropicEnumerateFunction(weight, q)

Parameters
diminteger

Dimension of the EnumerateFunction. dim must be equal to the dimension of the OrthogonalBasis.

qfloat

Correspond to the q-quasi norm parameter. If not precised, q = 0.4.

weightsequence of float

Weights of the indices in each dimension. If not precised, all weights are equals to w_i = 1.

Notes

The hyperbolic truncation strategy is inspired by the so-called sparsity-of- effects principle, which states that most models are principally governed by main effects and low-order interactions. Accordingly, one wishes to define an enumeration strategy which first selects those multi-indices related to main effects, i.e. with a reasonably small number of nonzero components, prior to selecting those associated with higher-order interactions.

For any real number q \in ]0, 1], one defines the anisotropic hyperbolic norm of a multi-index a by:

\| \vect{a} \|_{\vect{w}, q} = \left( \sum_{i=1}^{n_X} w_i a^q \right)^{1/q}

where the w_i’s are real positive numbers. This would lead to first select the basis polynomials depending on a specific subset of input variables.

Examples

>>> import openturns as ot
>>> # 4-dimensional case
>>> enumerateFunction = ot.HyperbolicAnisotropicEnumerateFunction(2, 0.5)
>>> for i in range(10):
...     print(enumerateFunction(i))
[0,0]
[1,0]
[0,1]
[2,0]
[0,2]
[3,0]
[0,3]
[1,1]
[4,0]
[0,4]

Methods

__call__(self, index)

Call self as a function.

getClassName(self)

Accessor to the object’s name.

getDimension(self)

Return the dimension of the EnumerateFunction.

getId(self)

Accessor to the object’s id.

getMaximumDegreeCardinal(self, maximumDegree)

Get the cardinal of indices of degree inferior or equal to a given value.

getMaximumDegreeStrataIndex(self, maximumDegree)

Get the index of the strata of degree inferior to a given value.

getName(self)

Accessor to the object’s name.

getQ(self)

Accessor to the norm.

getShadowedId(self)

Accessor to the object’s shadowed id.

getStrataCardinal(self, strataIndex)

Get the number of members of the basis associated to a given strata.

getStrataCumulatedCardinal(self, strataIndex)

Get the cardinal of the cumulated strata above or equal to the given strata.

getVisibility(self)

Accessor to the object’s visibility state.

getWeight(self)

Accessor to the weights.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

inverse(self, indices)

Get the antecedent of a indices list in the EnumerateFunction.

setDimension(self, dimension)

Set the dimension of the EnumerateFunction.

setName(self, name)

Accessor to the object’s name.

setQ(self, q)

Accessor to the norm.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

setWeight(self, weight)

Accessor to the weights.

__init__(self, \*args)

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

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getDimension(self)

Return the dimension of the EnumerateFunction.

Returns
dimint, dim \geq 0

Dimension of the EnumerateFunction.

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getMaximumDegreeCardinal(self, maximumDegree)

Get the cardinal of indices of degree inferior or equal to a given value.

Parameters
maximumDegreeint

Number of polynoms of the basis.

Returns
cardinalint

Cardinal of indices of degree max \leq maximumDegree.

Examples

>>> import openturns as ot
>>> enumerateFunction = ot.EnumerateFunction(ot.LinearEnumerateFunction(2))
>>> for i in range(6):
...     indices = enumerateFunction(i)
...     degree = sum(indices)
...     print(str(int(degree))+' '+str(indices))
0 [0,0]
1 [1,0]
1 [0,1]
2 [2,0]
2 [1,1]
2 [0,2]
>>> print(enumerateFunction.getMaximumDegreeCardinal(2))
6
getMaximumDegreeStrataIndex(self, maximumDegree)

Get the index of the strata of degree inferior to a given value.

Parameters
maximumDegreeint

Degree.

Returns
indexint

Index of the strata of degree max \leq maximumDegree.

Examples

>>> import openturns as ot
>>> enumerateFunction = ot.EnumerateFunction(ot.LinearEnumerateFunction(2))
>>> for i in [1, 2]:
...     indices = enumerateFunction(i)
...     strataIndex = sum(indices) + 1
...     print(str(int(strataIndex))+' '+str(indices))
2 [1,0]
2 [0,1]
>>> print(enumerateFunction.getMaximumDegreeStrataIndex(2))
2
getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getQ(self)

Accessor to the norm.

Returns
qfloat

q-quasi norm parameter.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getStrataCardinal(self, strataIndex)

Get the number of members of the basis associated to a given strata.

Parameters
strataIndexint

Index of the strata in the hierarchical basis. In the context of product of polynomial basis, this is the total polynom degree.

Returns
cardinalint

Number of members of the basis associated to the strata strataIndex. In the context of product of polynomial basis, this is the number of polynoms of the basis which total degree is strataIndex.

Examples

>>> import openturns as ot
>>> enumerateFunction = ot.EnumerateFunction(ot.LinearEnumerateFunction(2))
>>> for i in [3, 4, 5]:
...     indices = enumerateFunction(i)
...     degree = sum(indices)
...     print(str(int(degree))+' '+str(indices))
2 [2,0]
2 [1,1]
2 [0,2]
>>> print(enumerateFunction.getStrataCardinal(2))
3
getStrataCumulatedCardinal(self, strataIndex)

Get the cardinal of the cumulated strata above or equal to the given strata.

Parameters
strataIndexint

Index of the strata in the hierarchical basis. In the context of product of polynomial basis, this is the total polynomial degree.

Returns
cardinalint

Number of members of the basis associated to the strates inferior or equal to strataIndex. In the context of product of polynomial basis, this is the number of polynomials of the basis which total degree is inferior or equal to strataIndex.

Examples

>>> import openturns as ot
>>> enumerateFunction = ot.EnumerateFunction(ot.LinearEnumerateFunction(2))
>>> for i in range(6):
...     indices = enumerateFunction(i)
...     degree = sum(indices)
...     print(str(int(degree))+' '+str(indices))
0 [0,0]
1 [1,0]
1 [0,1]
2 [2,0]
2 [1,1]
2 [0,2]
>>> print(enumerateFunction.getStrataCumulatedCardinal(2))
6
getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

getWeight(self)

Accessor to the weights.

Returns
wPoint

Weights of the indices in each dimension.

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.

inverse(self, indices)

Get the antecedent of a indices list in the EnumerateFunction.

Parameters
multiIndexsequence of int

List of indices.

Returns
antecedentint

Represents the antecedent of the multiIndex in the EnumerateFunction.

Examples

>>> import openturns as ot
>>> enumerateFunction = ot.EnumerateFunction(ot.LinearEnumerateFunction(2))
>>> for i in range(6):
...     print(str(i)+' '+str(enumerateFunction(i)))
0 [0,0]
1 [1,0]
2 [0,1]
3 [2,0]
4 [1,1]
5 [0,2]
>>> print(enumerateFunction.inverse([1,1]))
4
setDimension(self, dimension)

Set the dimension of the EnumerateFunction.

Parameters
dimint, dim \geq 0

Dimension of the EnumerateFunction.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setQ(self, q)

Accessor to the norm.

Parameters
qfloat

q-quasi norm parameter.

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.

setWeight(self, weight)

Accessor to the weights.

Parameters
wsequence of float

Weights of the indices in each dimension.