File: t_RankSobolSensitivityAlgorithm_std.py

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (27 lines) | stat: -rwxr-xr-x 912 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

import openturns as ot
import openturns.experimental as otexp
from openturns.testing import assert_almost_equal
from openturns.usecases import ishigami_function

ot.RandomGenerator.SetSeed(0)
im = ishigami_function.IshigamiModel()
input_names = im.inputDistribution.getDescription()
n = 250
sampleX = im.inputDistribution.getSample(n)
sampleY = im.model(sampleX)

ot.ResourceMap.SetAsUnsignedInteger("SobolIndicesAlgorithm-DefaultBootstrapSize", 100)

mySobol = otexp.RankSobolSensitivityAlgorithm(sampleX, sampleY)
indices = mySobol.getFirstOrderIndices()
assert_almost_equal(indices, [0.208654, 0.493591, -0.0669488], 1.0e-4, 1.0e-2)

interval = mySobol.getFirstOrderIndicesInterval()
assert_almost_equal(
    interval.getLowerBound(), [0.117529, 0.409689, -0.176039], 1.0e-4, 1.0e-2
)
assert_almost_equal(
    interval.getUpperBound(), [0.340675, 0.560271, 0.0857027], 1.0e-4, 1.0e-2
)