Possible evaluation of Sobol indices directly from the FunctionalChaosAlgorithm?

Hello,
Is there a way to compute the Sobol indices directly from the FunctionalChaosAlgorithm class?
Regards,
Sarah

Hello,

FunctionalChaosAlgorithm allows to compute a Polynomial Chaos Expansion (PCE) model. A small post processing of the result provides the given Sobol indices

Here a basic example:

import openturns as ot
from math import pi
import openturns.viewer as otv
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)
distributionList = [ot.Uniform(-pi, pi)] * 3
distribution = ot.ComposedDistribution(distributionList)
N = 100
inputTrain = distribution.getSample(N)
outputTrain = g(inputTrain)
chaosalgo = ot.FunctionalChaosAlgorithm(inputTrain, outputTrain)
chaosalgo.run()
result = chaosalgo.getResult()
chaosSI = ot.FunctionalChaosSobolIndices(result)
print( chaosSI.summary() )
first_order = [chaosSI.getSobolIndex(k) for k in range(3)]
total_order = [chaosSI.getSobolTotalIndex(k) for k in range(3)]

Have a look also at this example or this one for more details

1 Like

Hi Sofiane,
Thank you so much! This is very helpful!
Sarah