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:
>>> chaosSI.getSobolIndex(0) 0.322659...
Get total order Sobol’ indices for X0:
>>> chaosSI.getSobolTotalIndex(0) 0.4744650...
Get first order Sobol’ indices for group [X0,X1]:
>>> chaosSI.getSobolGroupedIndex([0,1]) 0.78412698...
Get total order Sobol’ indices for group [X1,X2]:
>>> chaosSI.getSobolGroupedTotalIndex([1,2]) 0.6773409...
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
()Summary accessor.
- __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.
- Returns
- sfloat
The grouped Sobol first order indice.
- 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.
- Returns
- sfloat
The grouped Sobol total order indice.
- 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.
- out_marginalint
Output marginal Default value is 0
- Returns
- sfloat
The Sobol indice.
- 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.
- out_marginalint
Output marginal Default value is 0
- Returns
- sfloat
The total Sobol indice.
- 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.
- summary()¶
Summary accessor.
- Returns
- summarystr
A text summary of the sensitivity analysis to be shown in a console.