Skip to content

Instantly share code, notes, and snippets.

@sofianehaddad
Created December 21, 2016 11:18
Show Gist options
  • Save sofianehaddad/f3bb2ac1b9c20fbf739fad7a1994dd1f to your computer and use it in GitHub Desktop.
Save sofianehaddad/f3bb2ac1b9c20fbf739fad7a1994dd1f to your computer and use it in GitHub Desktop.
Ishigami and 'decentered' Ishigami
from SALib.sample import saltelli
from SALib.analyze import sobol
from SALib.test_functions import Ishigami
import numpy as np
problem = {
'num_vars': 3,
'names': ['x1', 'x2', 'x3'],
'bounds': [[-np.pi, np.pi],
[-np.pi, np.pi],
[-np.pi, np.pi]]
}
size = 1000
param_values = saltelli.sample(problem, size, calc_second_order=False)
Y = Ishigami.evaluate(param_values)
Si = sobol.analyze(problem, Y, print_to_console=False, calc_second_order=False)
print("Usual Ishigami")
print(Si['S1'])
print(Si['ST'])
Z = Ishigami.evaluate(param_values) + 1000
Si = sobol.analyze(problem, Z, print_to_console=False, calc_second_order=False)
print("Decentered Ishigami")
print(Si['S1'])
print(Si['ST'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment