FunctionalChaosSobolIndices¶
- class FunctionalChaosSobolIndices(*args)¶
Sensitivity analysis based on functional chaos expansion.
- Parameters:
- result
FunctionalChaosResult
A functional chaos result resulting from a polynomial chaos decomposition.
- result
Notes
This structure is created from a FunctionalChaosResult in order to evaluate the Sobol indices associated to the polynomial chaos decomposition of the model. The SobolIndicesAlgorithm.DrawSobolIndices static method can be used to draw the indices.
Examples
Create a polynomial chaos for the Ishigami function:
>>> import openturns as ot >>> from math import pi >>> import openturns.viewer as otv
Create the function:
>>> ot.RandomGenerator.SetSeed(0) >>> formula = ['sin(X1) + 7. * sin(X2)^2 + 0.1 * X3^4 * sin(X1)'] >>> input_names = ['X1', 'X2', 'X3'] >>> g = ot.SymbolicFunction(input_names, formula)
Create the probabilistic model:
>>> distributionList = [ot.Uniform(-pi, pi)] * 3 >>> distribution = ot.ComposedDistribution(distributionList)
Create a training sample:
>>> N = 100 >>> inputTrain = distribution.getSample(N) >>> outputTrain = g(inputTrain)
Create the chaos:
>>> chaosalgo = ot.FunctionalChaosAlgorithm(inputTrain, outputTrain) >>> chaosalgo.run() >>> result = chaosalgo.getResult()
Print Sobol’ indices :
>>> chaosSI = ot.FunctionalChaosSobolIndices(result) >>> #print( chaosSI.summary() )
Get first order Sobol’ indices for X0:
>>> s0 = chaosSI.getSobolIndex(0)
Get total order Sobol’ indices for X0:
>>> st0 = chaosSI.getSobolTotalIndex(0)
Get first order Sobol’ indices for group [X0,X1]:
>>> stg01 = chaosSI.getSobolGroupedIndex([0,1])
Get total order Sobol’ indices for group [X1,X2]:
>>> stg12 = chaosSI.getSobolGroupedTotalIndex([1,2])
Methods
Accessor to the object's name.
Accessor to the functional chaos result.
getId
()Accessor to the object's id.
getName
()Accessor to the object's name.
Accessor to the object's shadowed id.
getSobolGroupedIndex
(*args)Get the grouped Sobol first order indices.
getSobolGroupedTotalIndex
(*args)Get the grouped Sobol total order indices.
getSobolIndex
(*args)Get the Sobol indices.
getSobolTotalIndex
(*args)Get the total Sobol indices.
Accessor to the object's visibility state.
hasName
()Test if the object is named.
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.
summary
- __init__(*args)¶
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getFunctionalChaosResult()¶
Accessor to the functional chaos result.
- Returns:
- functionalChaosResult
FunctionalChaosResult
The functional chaos result resulting from a polynomial chaos decomposition.
- functionalChaosResult
- 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.
- getSobolGroupedIndex(*args)¶
Get the grouped Sobol first order indices.
- Parameters:
- iint or sequence of int,
Indice(s) of the variable(s) we want the associated grouped Sobol indices. is the dimension of the input variables.
- marginalIndexint
Output marginal index. Default value is 0, i.e. the first output.
- Returns:
- sfloat
The grouped Sobol first order index.
- getSobolGroupedTotalIndex(*args)¶
Get the grouped Sobol total order indices.
- Parameters:
- iint or sequence of int,
Indice(s) of the variable(s) we want the associated grouped Sobol indices. is the dimension of the input variables.
- marginalIndexint
Output marginal index. Default value is 0, i.e. the first output.
- Returns:
- sfloat
The grouped Sobol total order index.
- getSobolIndex(*args)¶
Get the Sobol indices.
- Parameters:
- iint or sequence of int,
Indice(s) of the variable(s) we want the associated Sobol indices. is the dimension of the input variables.
- marginalIndexint
Output marginal index. Default value is 0, i.e. the first output.
- Returns:
- sfloat
The first order Sobol index.
- getSobolTotalIndex(*args)¶
Get the total Sobol indices.
- Parameters:
- iint or sequence of int,
Indice(s) of the variable(s) we want the associated total Sobol indices. is the dimension of the input variables.
- marginalIndexint
Output marginal index. Default value is 0, i.e. the first output.
- Returns:
- sfloat
The total Sobol index.
- 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¶
Compute grouped indices for the Ishigami function
Create a polynomial chaos metamodel
Create a polynomial chaos for the Ishigami function: a quick start guide to polynomial chaos
Compute Sobol’ indices confidence intervals
Sobol’ sensitivity indices from chaos
Example of sensitivity analyses on the wing weight model