algo.setMaximumOuterSampling(1000)
algo.setBlockSize(1)
algo.setCoefficientOfVariationCriterionType('NONE')
algo.run()
result = algo.getResult()
expectation = result.getExpectationEstimate()
print("Mean by ESA = %f " % expectation[0])
expectationDistribution = result.getExpectationDistribution()

View(expectationDistribution.drawPDF())
pl.savefig("MeanDistribution.pdf")

# Sensitivity analysis
estimator = ot.SaltelliSensitivityAlgorithm()
estimator.setUseAsymptoticDistribution(True)
algo = ot.SobolSimulationAlgorithm(X, g, estimator)
algo.setMaximumOuterSampling(25)  # number of iterations
algo.setBlockSize(100)  # size of Sobol experiment at each iteration
algo.setBatchSize(4)  # number of points evaluated simultaneously
algo.setIndexQuantileLevel(0.05)  # alpha
algo.setIndexQuantileEpsilon(1e-2)  # epsilon
algo.run()
result = algo.getResult()
fo = result.getFirstOrderIndicesEstimate()
print("First order:")
print(fo)
to = result.getTotalOrderIndicesEstimate()
print("Total order:")
print(to)
foDist = result.getFirstOrderIndicesDistribution()
saest = algo.getEstimator()
Beispiel #2
0
#a[i] = 0.5 * i
#covTh = covTh * (1.0 + 1.0 / (3.0 * (1.0 + a[i]) ** 2))
#inputVariables[i] = "xi" + str(i)
#formula += " * ((abs(4.0 * xi" + str(i) + " - 2.0) + " + str(a[i]) + ") / (1.0 + " + str(a[i]) + "))"
#covTh = covTh - 1.0
#model = ot.SymbolicFunction(inputVariables, [formula])
#distribution = ot.ComposedDistribution([ot.Uniform(0.0, 1.0)] * dimension)

# ishigami
formula = 'sin(pi_*X1)+7*sin(pi_*X2)*sin(pi_*X2)+0.1*((pi_*X3)*(pi_*X3)*(pi_*X3)*(pi_*X3))*sin(pi_*X1)'
model = ot.SymbolicFunction(['X1', 'X2', 'X3'], [formula])
distribution = ot.ComposedDistribution([ot.Uniform(-1.0, 1.0)] * dimension)

estimator = ot.SaltelliSensitivityAlgorithm()
estimator.setUseAsymptoticDistribution(True)
algo = ot.SobolSimulationAlgorithm(distribution, model, estimator)
algo.setMaximumOuterSampling(250)  # number of iterations
# size N of Sobol experiment at each iteration, total size is N*(d+2)
algo.setBlockSize(10000)
algo.setBatchSize(97)  # number of points evaluated simultaneously
algo.setIndexQuantileLevel(0.05)
algo.setIndexQuantileEpsilon(1e-2)
# algo.setProgressCallback(progress)
# algo.setStopCallback(stop)

print('algo=', algo)

# Perform the simulation
algo.run()

# Stream out the result