FieldFunctionalChaosSobolIndices

class FieldFunctionalChaosSobolIndices(*args)

Sobol indices from a functional decomposition.

Warning

This class is experimental and likely to be modified in future releases. To use it, import the openturns.experimental submodule.

This class allows one to perform sensitivity analysis from field chaos decomposition. The process decomposition is done by Karhunen-Loeve and the modes interpolation is performed by functional chaos:

\tilde{g}(x) = \sum_{k \in K_c} \beta_{\vect{\alpha}_k} \Psi_{\vect{\alpha}_k}(x)

Let us expand the multi indices notation:

\Psi_{\vect{\alpha}}(x) = \prod_{j=1}^{K_T} P^j_{\alpha_j}(x_j)

with

\vect{\alpha} \in \mathbb{N}^{K_T} = \{\underbrace{\alpha_1, \dots, \alpha_{K_1}}_{K_1},\dots,\underbrace{\alpha_{K_T-K_d}, \dots, \alpha_{K_T}}_{K_d}\}

see FunctionalChaosAlgorithm for details.

Sobol indices of the input field component j \in [1,d] can be computed from the coefficients of the chaos decomposition that involve the matching Karhunen-Loeve coefficients.

For the first order Sobol indices we sum over the multi-indices \vect{\alpha}_k that are non-zero on the K_j indices corresponding to the Karhunen-Loeve decomposition of j-th input and zero on the other K_T - K_j indices (noted G_j):

S_j = \frac{\sum_{k=1, \vect{\alpha}_k \in G_j}^{K_c} \beta_{\vect{\alpha}_k}^2}{\sum_{k=1}^{K_c} \beta_{\vect{\alpha}_k}^2}

For the total order Sobol indices we sum over the multi-indices \vect{\alpha}_k that are non-zero on the K_j indices corresponding to the Karhunen-Loeve decomposition of the j-th input (noted GT_j):

S_{T_j} = \frac{\sum_{k=1, \vect{\alpha}_k \in GT_j}^{K_c} \beta_{\vect{\alpha}_k}^2}{\sum_{k=1}^{K_c} \beta_{\vect{\alpha}_k}^2}

This generalizes to higher order indices.

Parameters:
resultFieldFunctionalChaosResult

Result.

Examples

>>> import openturns as ot
>>> import openturns.experimental as otexp
>>> ot.RandomGenerator.SetSeed(0)
>>> mesh = ot.RegularGrid(0.0, 0.1, 20)
>>> cov = ot.KroneckerCovarianceModel(ot.MaternModel([2.0], 1.5), ot.CovarianceMatrix(4))
>>> X = ot.GaussianProcess(cov, mesh)
>>> x = X.getSample(500)
>>> y = []
>>> for xi in x:
...     m = xi.computeMean()
...     y.append([m[0] + m[1] + m[2] - m[3] + m[0] * m[1] - m[2] * m[3] - 0.1 * m[0] * m[1] * m[2]])
>>> algo = otexp.FieldToPointFunctionalChaosAlgorithm(x, y)
>>> algo.setThreshold(4e-2)
>>> # Temporarily lower the basis size for the sake of this example.
>>> # We need to store the original size.
>>> bs = ot.ResourceMap.GetAsUnsignedInteger('FunctionalChaosAlgorithm-BasisSize')
>>> ot.ResourceMap.SetAsUnsignedInteger('FunctionalChaosAlgorithm-BasisSize', 100)
>>> algo.run()
>>> # The algorithm has been run with the lower basis size:
>>> # we can now restore the original value.
>>> ot.ResourceMap.SetAsUnsignedInteger('FunctionalChaosAlgorithm-BasisSize', bs)
>>> result = algo.getResult()
>>> sensitivity = otexp.FieldFunctionalChaosSobolIndices(result)
>>> sobol_1 = sensitivity.getFirstOrderIndices()
>>> sobol_t = sensitivity.getTotalOrderIndices()

Methods

draw([marginalIndex])

Draw sensitivity indices.

getClassName()

Accessor to the object's name.

getFirstOrderIndices([marginalIndex])

Get the first order Sobol indices.

getId()

Accessor to the object's id.

getName()

Accessor to the object's name.

getShadowedId()

Accessor to the object's shadowed id.

getSobolIndex(*args)

Get a single Sobol index.

getSobolTotalIndex(*args)

Get a single Sobol index.

getTotalOrderIndices([marginalIndex])

Get the total order Sobol indices.

getVisibility()

Accessor to the object's visibility state.

hasName()

Test if the object is named.

hasVisibleName()

Test if the object has a distinguishable name.

setName(name)

Accessor to the object's name.

setShadowedId(id)

Accessor to the object's shadowed id.

setVisibility(visible)

Accessor to the object's visibility state.

__init__(*args)
draw(marginalIndex=0)

Draw sensitivity indices.

Parameters:
marginalIndexint, default=0

Marginal index

Returns:
graphGraph

A graph showing the first and total order indices per input.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

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

getFirstOrderIndices(marginalIndex=0)

Get the first order Sobol indices.

Parameters:
jint, default=0

Output index

Returns:
indicesPoint

First order Sobol indices

getId()

Accessor to the object’s id.

Returns:
idint

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:
idint

Internal unique identifier.

getSobolIndex(*args)

Get a single Sobol index.

Parameters:
iint or list of int

Input index

jint, default=0

Output index

Returns:
sfloat

Sobol index

getSobolTotalIndex(*args)

Get a single Sobol index.

Parameters:
iint or list of int

Input index

jint, default=0

Output index

Returns:
sfloat

Sobol index

getTotalOrderIndices(marginalIndex=0)

Get the total order Sobol indices.

Parameters:
jint, default=0

Output index

Returns:
indicesPoint

Total order Sobol indices

getVisibility()

Accessor to the object’s visibility state.

Returns:
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:
hasVisibleNamebool

True if the name is not empty and not the default one.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:
visiblebool

Visibility flag.

Examples using the class

Estimate Sobol indices on a field to point function

Estimate Sobol indices on a field to point function