FunctionalChaosSobolIndices¶
-
class
FunctionalChaosSobolIndices
(*args)¶ Sensitivity analysis based on functional chaos expansion.
- Available constructors:
FunctionalChaosSobolIndices(functionalChaosResult)
- Parameters
- functionalChaosResult
FunctionalChaosResult
A functional chaos result resulting from a polynomial chaos decomposition.
- functionalChaosResult
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.3400236...
Get total order Sobol’ indices for X0:
>>> chaosSI.getSobolTotalIndex(0) 0.4940954...
Get first order Sobol’ indices for group [X0,X1]:
>>> chaosSI.getSobolGroupedIndex([0,1]) 0.7882764...
Get total order Sobol’ indices for group [X1,X2]:
>>> chaosSI.getSobolGroupedTotalIndex([1,2]) 0.6599763...
Methods
getClassName
(self)Accessor to the object’s name.
getFunctionalChaosResult
(self)Accessor to the functional chaos result.
getId
(self)Accessor to the object’s id.
getName
(self)Accessor to the object’s name.
getShadowedId
(self)Accessor to the object’s shadowed id.
getSobolGroupedIndex
(self, \*args)Get the grouped Sobol first order indices.
getSobolGroupedTotalIndex
(self, \*args)Get the grouped Sobol total order indices.
getSobolIndex
(self, \*args)Get the Sobol indices.
getSobolTotalIndex
(self, \*args)Get the total Sobol indices.
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.
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.
summary
(self)Summary accessor.
-
__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__).
-
getFunctionalChaosResult
(self)¶ Accessor to the functional chaos result.
- Returns
- functionalChaosResult
FunctionalChaosResult
The functional chaos result resulting from a polynomial chaos decomposition.
- functionalChaosResult
-
getId
(self)¶ Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
-
getName
(self)¶ Accessor to the object’s name.
- Returns
- namestr
The name of the object.
-
getShadowedId
(self)¶ Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
-
getSobolGroupedIndex
(self, \*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
(self, \*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
(self, \*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
(self, \*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
(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.
-
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.
-
summary
(self)¶ Summary accessor.
- Returns
- summarystr
A text summary of the sensitivity analysis to be shown in a console.