예제 #1
0
print("Morris experiment generated from grid = ", sample1)

print("Use Case #2 : generate trajectories from initial lhs design")
size = 20
# Generate an LHS design
dist = ot.ComposedDistribution(2 * [ot.Uniform(0, 1)])
experiment = ot.LHSExperiment(dist, size, True, False)
lhsDesign = experiment.generate()
print("Initial LHS design = ", lhsDesign)
# Generate designs
morris_experiment_lhs = otmorris.MorrisExperimentLHS(lhsDesign, r)
lhs_bound = morris_experiment_lhs.getBounds()
sample2 = morris_experiment.generate()
print("Morris experiment generated from LHS = ", sample2)

# Define model
model = ot.SymbolicFunction(["x", "y"], ["cos(x)*y + sin(y)*x + x*y -0.1"])

# Define Morris method with two designs
morrisEE1 = otmorris.Morris(sample1, model(sample1), grid_bound)
morrisEE2 = otmorris.Morris(sample2, model(sample2), lhs_bound)
print("Using level grid, E(|EE|)  = ",
      morrisEE1.getMeanAbsoluteElementaryEffects())
print("                  V(|EE|)^{1/2} = ",
      morrisEE1.getStandardDeviationElementaryEffects())

print("Using initial LHS, E(|EE|)  = ",
      morrisEE2.getMeanAbsoluteElementaryEffects())
print("                   V(|EE|)^{1/2} = ",
      morrisEE2.getStandardDeviationElementaryEffects())
예제 #2
0
import openturns as ot
import otmorris
from otmorris.plot_sensitivity import PlotEE
# Number of trajectories
r = 10
# Define experiments in [0,1]^20
# p-levels
p = 5
morris_experiment = otmorris.MorrisExperiment([p] * 20, r)
X = morris_experiment.generate()
f = ot.NumericalMathFunction(otmorris.MorrisFunction())
Y = f(X)
# Evaluate Elementary effects (ee)
ee = otmorris.Morris(X, Y)
# Compute mu/sigma
mean = ee.getMeanAbsoluteElementaryEffects()
sigma = ee.getStandardDeviationElementaryEffects()
fig = PlotEE(ee)
fig.show()

예제 #3
0
print("Morris experiment generated from grid = ", sample1)

print("Use Case #2 : generate trajectories from initial lhs design")
size = 20
# Generate an LHS design
dist = ot.ComposedDistribution(2 * [ot.Uniform(0, 1)])
experiment = ot.LHSExperiment(dist, size, True, False)
lhsDesign = experiment.generate()
print("Initial LHS design = ", lhsDesign)
# Generate designs
morris_experiment_lhs = otmorris.MorrisExperiment(lhsDesign, r)
sample2 = morris_experiment.generate()
print("Morris experiment generated from LHS = ", sample2)

# Define model
model = ot.NumericalMathFunction(["x", "y"],
                                 ["cos(x)*y + sin(y)*x + x*y -0.1"])

# Define Morris method with two designs
morrisEE1 = otmorris.Morris(sample1, model(sample1))
morrisEE2 = otmorris.Morris(sample2, model(sample2))
print("Using level grid, E(|EE|)  = ",
      morrisEE1.getMeanAbsoluteElementaryEffects())
print("                  V(|EE|)^{1/2} = ",
      morrisEE1.getStandardDeviationElementaryEffects())

print("Using initial LHS, E(|EE|)  = ",
      morrisEE2.getMeanAbsoluteElementaryEffects())
print("                   V(|EE|)^{1/2} = ",
      morrisEE2.getStandardDeviationElementaryEffects())
예제 #4
0
E = ot.ParametrizedDistribution(ot.LogNormalMuSigmaOverMu(3e4, 0.12))
F = ot.ParametrizedDistribution(ot.LogNormalMuSigmaOverMu(0.1, 0.20))
list_marginals = [L, b, h, E, F]
distribution = ot.ComposedDistribution(list_marginals)
distribution.setDescription(('L', 'b', 'h', 'E', 'F'))
dim = distribution.getDimension()

level_number = 4
trajectories = 10
jump_step = int(level_number / 2)
levels = [level_number] * dim

# set the bounds of the grid experiment
bound = ot.Interval(
    [marginal.computeQuantile(0.01)[0] for marginal in list_marginals],
                    [marginal.computeQuantile(0.99)[0] for marginal in list_marginals])
experiment = otmorris.MorrisExperimentGrid(levels, bound, trajectories)
experiment.setJumpStep(ot.Indices([jump_step] * dim))

# create and compute the design of experiments
input_sample = experiment.generate()
print("Morris experiment generated from grid = ")
print(input_sample)
output_sample = poutre(input_sample)

# run the Morris analysis
morris = otmorris.Morris(input_sample, output_sample, bound)
print("E(|EE|)  = ", morris.getMeanAbsoluteElementaryEffects())
print("E(EE)  = ", morris.getMeanElementaryEffects())
print("V(|EE|)^{1/2} = ", morris.getStandardDeviationElementaryEffects())
예제 #5
0
import openturns as ot
import otmorris
from otmorris.plot_sensitivity import PlotEE

# Number of trajectories
r = 10
dim = 20
# Define an LHS experiment of size 50 in [0, 1]^20
size = 50
dist = ot.ComposedDistribution([ot.Uniform(0, 1)] * dim)
lhs_experiment = ot.LHSExperiment(dist, size, True, False)
lhsDesign = lhs_experiment.generate()
morris_experiment = otmorris.MorrisExperimentLHS(lhsDesign, r)
bounds = ot.Interval(dim) # [0, 1]^2
X = morris_experiment.generate()
f = ot.Function(otmorris.MorrisFunction())
Y = f(X)
# Evaluate Elementary effects (ee)
ee = otmorris.Morris(X, Y, bounds)
# Compute mu/sigma
mean = ee.getMeanAbsoluteElementaryEffects()
sigma = ee.getStandardDeviationElementaryEffects()
fig = PlotEE(ee, title="Elementary Effects using LHS")
fig.show()