Note
Go to the end to download the full example code.
Print the sensitivity analysis problems¶
In this example, we show how to print all the sensitivity analysis problems.
import otbenchmark as otb
import pandas as pd
We import the list of problems.
benchmarkProblemList = otb.SensitivityBenchmarkProblemList()
numberOfProblems = len(benchmarkProblemList)
print(numberOfProblems)
11
For each problem in the benchmark, print the problem name and the exact Sobol’ indices.
for i in range(numberOfProblems):
problem = benchmarkProblemList[i]
name = problem.getName()
first_order_indices = problem.getFirstOrderIndices()
total_order_indices = problem.getTotalOrderIndices()
dimension = problem.getInputDistribution().getDimension()
print(
"#",
i,
":",
name,
" : S = ",
first_order_indices,
"T=",
total_order_indices,
", dimension=",
dimension,
)
# 0 : GaussianSum : S = [0.5,0.5] T= [0.5,0.5] , dimension= 2
# 1 : GaussianProduct : S = [0,0] T= [1,1] , dimension= 2
# 2 : GSobol : S = [0.986712,0.00986712,9.86712e-05] T= [0.990034,0.0131566,0.000132] , dimension= 3
# 3 : Ishigami : S = [0.313905,0.442411,0] T= [0.557589,0.442411,0.243684] , dimension= 3
# 4 : Borehole : S = [0.66,0,0,0.09,0,0.09,0.09,0.02] T= [0.69,0,0,0.11,0,0.11,0.1,0.02] , dimension= 8
# 5 : Dirichlet : S = [0.525547,0.233577,0.131387] T= [0.620438,0.310219,0.182482] , dimension= 3
# 6 : Flooding : S = [0.38,0.13,0.25,0,0.19,0.02,0,0] T= [0.4,0.15,0.25,0.01,0.19,0.02,0,0] , dimension= 8
# 7 : Morris : S = [0.08,0.08,0.06,0.08,0.06,0.13,0.06,0.13,0.13,0.12,0,0,0,0,0,0,0,0,0,0]#20 T= [0.11,0.11,0.06,0.11,0.06,0.13,0.06,0.13,0.13,0.12,0,0,0,0,0,0,0,0,0,0]#20 , dimension= 20
# 8 : N.L. Oscillator : S = [0.4,0.03,0.09,0.18,0.12,0.05,0.05,0] T= [0.4,0.04,0.1,0.23,0.16,0.07,0.06,0.01] , dimension= 8
# 9 : Borgonovo : S = [0.157895,0.157895,0.631579] T= [0.210526,0.210526,0.631579] , dimension= 3
# 10 : Oakley-O'Hagan : S = [0,0,0,0,0,0.02,0.02,0.03,0.05,0.01,0.1,0.14,0.1,0.11,0.12]#15 T= [0.06,0.06,0.04,0.05,0.02,0.04,0.06,0.08,0.1,0.04,0.15,0.15,0.14,0.14,0.16]#15 , dimension= 15
problem_names = [
benchmarkProblem.getName() for benchmarkProblem in benchmarkProblemList
]
columns = ["$d$"]
df_problems_list = pd.DataFrame(index=problem_names, columns=columns)
for problem in benchmarkProblemList:
name = problem.getName()
d = problem.getInputDistribution().getDimension()
df_problems_list.loc[name] = [int(d)]
print(df_problems_list)
$d$
GaussianSum 2
GaussianProduct 2
GSobol 3
Ishigami 3
Borehole 8
Dirichlet 3
Flooding 8
Morris 20
N.L. Oscillator 8
Borgonovo 3
Oakley-O'Hagan 15
latex_code = df_problems_list.to_latex()
# text_file = open("sensitivity_problems_list.tex", "w")
# text_file.write(latex_code)
# text_file.close()
Total running time of the script: (0 minutes 0.112 seconds)