list_sampleSize = np.logspace(1, 5, n_loops) # n_loops valeurs de 1e1 à 1e5 ref_sampleSize = 4e5 ref_nrepetitions = 1000 ################################################################################ ################# GSOBOL ##################### ################################################################################ a = array([0, 9, 99]) # Distribution uniforme associée au cas-test GSobol distribution_gsobol = gsobolDistribution(len(a)) model_gsobol = ot.PythonFunction(len(a), 1, func_sample=lambda X: gsobol(X, a)) model_gsobol.setName("G-Sobol") # Saltelli runConvergence(model_gsobol, distribution_gsobol, SaltelliSensitivityAlgorithm, list_sampleSize, ref_sampleSize, ref_nrepetitions) # Jansen runConvergence(model_gsobol, distribution_gsobol, JansenSensitivityAlgorithm, list_sampleSize, ref_sampleSize, ref_nrepetitions) # Mauntz runConvergence(model_gsobol, distribution_gsobol, MauntzKucherenkoSensitivityAlgorithm, list_sampleSize,
# Taille du plan d'expérience de base pour estimer S et ST sampleSize = 1000 # Nombre de répétition de l'expérience nrepetitions = 500 # Estimations des indices du premier ordre sampleFirstMartinez = ot.Sample(nrepetitions, 3) # Estimations des indices totaux sampleTotalMartinez = ot.Sample(nrepetitions, 3) for i in range(nrepetitions): inputDesign = ot.SobolIndicesExperiment(distribution, sampleSize).generate() outputDesign = gsobol(inputDesign, a) sensitivity_algorithm = ot.SaltelliSensitivityAlgorithm( inputDesign, outputDesign, sampleSize) fo = sensitivity_algorithm.getFirstOrderIndices() to = sensitivity_algorithm.getTotalOrderIndices() for j in range(d): sampleFirstMartinez[i, j] = fo[j] for j in range(d): sampleTotalMartinez[i, j] = to[j] fig = pl.figure(figsize=(12, 8)) for j in range(d): ax = fig.add_subplot(2, 3, 1 + j) graph = ot.HistogramFactory().build(sampleFirstMartinez[:, j]).drawPDF() graph.setXTitle("S%d" % (d)) graph.setLegends([""])
if __name__ == "__main__": # Sizes of simulation n_loops = 10 list_sampleSize_float = np.logspace(1, 5, n_loops) # n_loops valeurs de 1e1 à 1e5 list_sampleSize = [int(v) for v in list_sampleSize_float] ref_sampleSize = 4e5 ref_nrepetitions = 1000 # GSOBOL a = array([0, 9, 99]) # Distribution uniforme associée au cas-test GSobol distribution_gsobol = gsobolDistribution(len(a)) model_gsobol = ot.PythonFunction(len(a), 1, func_sample=lambda X: gsobol(X, a)) model_gsobol.setName("G-Sobol") # Saltelli runConvergence( model_gsobol, distribution_gsobol, SaltelliSensitivityAlgorithm, list_sampleSize, ) # Jansen runConvergence( model_gsobol, distribution_gsobol, JansenSensitivityAlgorithm,