.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/uncertainty/plot_u_parameter_space.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_uncertainty_plot_u_parameter_space.py: Parameter space =============== In this example, we will see the basics of :class:`.ParameterSpace`. .. GENERATED FROM PYTHON SOURCE LINES 28-40 .. code-block:: Python from __future__ import annotations from gemseo import configure_logger from gemseo import create_discipline from gemseo import create_scenario from gemseo.algos.parameter_space import ParameterSpace from gemseo.post.dataset.scatter_plot_matrix import ScatterMatrix configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 41-45 Create a parameter space ------------------------ Firstly, the creation of a :class:`.ParameterSpace` does not require any mandatory argument: .. GENERATED FROM PYTHON SOURCE LINES 45-47 .. code-block:: Python parameter_space = ParameterSpace() .. GENERATED FROM PYTHON SOURCE LINES 48-51 Then, we can add either deterministic variables from their lower and upper bounds (use :meth:`.ParameterSpace.add_variable`): .. GENERATED FROM PYTHON SOURCE LINES 51-53 .. code-block:: Python parameter_space.add_variable("x", l_b=-2.0, u_b=2.0) .. GENERATED FROM PYTHON SOURCE LINES 54-56 or uncertain variables from their distribution names and parameters (use :meth:`.ParameterSpace.add_random_variable`): .. GENERATED FROM PYTHON SOURCE LINES 56-59 .. code-block:: Python parameter_space.add_random_variable("y", "SPNormalDistribution", mu=0.0, sigma=1.0) parameter_space .. raw:: html
Parameter space:
Name Lower bound Value Upper bound Type Distribution
x -2 None 2 float
y -inf 0 inf float norm(mu=0.0, sigma=1.0)


.. GENERATED FROM PYTHON SOURCE LINES 60-67 .. warning:: We cannot mix probability distributions from different families, e.g. an :class:`.OTDistribution` and a :class:`.SPDistribution`. We can check that the variables *x* and *y* are implemented as deterministic and uncertain variables respectively: .. GENERATED FROM PYTHON SOURCE LINES 67-69 .. code-block:: Python parameter_space.is_deterministic("x"), parameter_space.is_uncertain("y") .. rst-class:: sphx-glr-script-out .. code-block:: none (True, True) .. GENERATED FROM PYTHON SOURCE LINES 70-77 Note that when GEMSEO does not offer a class for the SciPy distribution, we can use the generic GEMSEO class :class:`.SPDistribution` to create any SciPy distribution by setting ``interfaced_distribution`` to its SciPy name and ``parameters`` as a dictionary of SciPy parameter names and values (`see the documentation of SciPy `__). .. GENERATED FROM PYTHON SOURCE LINES 77-85 .. code-block:: Python # parameter_space.add_random_variable( # "y", # "SPDistribution", # interfaced_distribution="norm", # parameters={"loc": 1.0, "scale": 2.0}, # ) .. GENERATED FROM PYTHON SOURCE LINES 86-96 A similar procedure can be followed for OpenTURNS distributions for which GEMSEO does not offer a class directly. We can use the generic GEMSEO class :class:`.OTDistribution` to create any OpenTURNS distribution by setting ``interfaced_distribution`` to its OpenTURNS name and ``parameters`` as a tuple of OpenTURNS parameter values (`see the documentation of OpenTURNS `__). .. GENERATED FROM PYTHON SOURCE LINES 96-104 .. code-block:: Python # parameter_space.add_random_variable( # "y", # "OTDistribution", # interfaced_distribution="Normal", # parameters=(1.0, 2.0), # ) .. GENERATED FROM PYTHON SOURCE LINES 105-109 Sample from the parameter space ------------------------------- We can sample the uncertain variables from the :class:`.ParameterSpace` and get values either as a NumPy array (by default) .. GENERATED FROM PYTHON SOURCE LINES 109-112 .. code-block:: Python sample = parameter_space.compute_samples(n_samples=2, as_dict=True) sample .. rst-class:: sphx-glr-script-out .. code-block:: none [{'y': array([-0.45949272])}, {'y': array([-2.84088122])}] .. GENERATED FROM PYTHON SOURCE LINES 113-114 or as a dictionary of NumPy arrays indexed by the names of the variables: .. GENERATED FROM PYTHON SOURCE LINES 114-117 .. code-block:: Python sample = parameter_space.compute_samples(n_samples=4) sample .. rst-class:: sphx-glr-script-out .. code-block:: none array([[ 0.5770075 ], [ 0.53609591], [ 0.84681924], [-0.34940697]]) .. GENERATED FROM PYTHON SOURCE LINES 118-123 Sample a discipline over the parameter space -------------------------------------------- We can also sample a discipline over the parameter space. For simplicity, we instantiate an :class:`.AnalyticDiscipline` from a dictionary of expressions: .. GENERATED FROM PYTHON SOURCE LINES 123-125 .. code-block:: Python discipline = create_discipline("AnalyticDiscipline", expressions={"z": "x+y"}) .. GENERATED FROM PYTHON SOURCE LINES 126-143 From these parameter space and discipline, we build a :class:`.DOEScenario` and execute it with a Latin Hypercube Sampling algorithm and 100 samples. .. warning:: A :class:`.DOEScenario` considers all the variables available in its :class:`.DesignSpace`. By inheritance, in the special case of a :class:`.ParameterSpace`, a :class:`.DOEScenario` considers all the variables available in this :class:`.ParameterSpace`. Thus, if we do not filter the uncertain variables, the :class:`.DOEScenario` will consider both the deterministic variables as uniformly distributed variables and the uncertain variables with their specified probability distributions. .. GENERATED FROM PYTHON SOURCE LINES 143-149 .. code-block:: Python scenario = create_scenario( [discipline], "DisciplinaryOpt", "z", parameter_space, scenario_type="DOE" ) scenario.execute({"algo": "lhs", "n_samples": 100}) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 13:52:19: INFO - 13:52:19: *** Start DOEScenario execution *** INFO - 13:52:19: DOEScenario INFO - 13:52:19: Disciplines: AnalyticDiscipline INFO - 13:52:19: MDO formulation: DisciplinaryOpt INFO - 13:52:19: Optimization problem: INFO - 13:52:19: minimize z(x, y) INFO - 13:52:19: with respect to x, y INFO - 13:52:19: over the design space: INFO - 13:52:19: +------+-------------+-------+-------------+-------+-------------------------+ INFO - 13:52:19: | Name | Lower bound | Value | Upper bound | Type | Distribution | INFO - 13:52:19: +------+-------------+-------+-------------+-------+-------------------------+ INFO - 13:52:19: | x | -2 | None | 2 | float | | INFO - 13:52:19: | y | -inf | 0 | inf | float | norm(mu=0.0, sigma=1.0) | INFO - 13:52:19: +------+-------------+-------+-------------+-------+-------------------------+ INFO - 13:52:19: Solving optimization problem with algorithm lhs: INFO - 13:52:19: 1%| | 1/100 [00:00<00:00, 391.19 it/sec, obj=3.12] INFO - 13:52:19: 2%|▏ | 2/100 [00:00<00:00, 612.44 it/sec, obj=1.72] INFO - 13:52:19: 3%|▎ | 3/100 [00:00<00:00, 771.67 it/sec, obj=0.181] INFO - 13:52:19: 4%|▍ | 4/100 [00:00<00:00, 880.19 it/sec, obj=3.76] INFO - 13:52:19: 5%|▌ | 5/100 [00:00<00:00, 970.95 it/sec, obj=2.15] INFO - 13:52:19: 6%|▌ | 6/100 [00:00<00:00, 1042.71 it/sec, obj=-0.666] INFO - 13:52:19: 7%|▋ | 7/100 [00:00<00:00, 1101.03 it/sec, obj=1.53] INFO - 13:52:19: 8%|▊ | 8/100 [00:00<00:00, 1146.10 it/sec, obj=1.7] INFO - 13:52:19: 9%|▉ | 9/100 [00:00<00:00, 1185.91 it/sec, obj=-2.27] INFO - 13:52:19: 10%|█ | 10/100 [00:00<00:00, 1214.51 it/sec, obj=-2.08] INFO - 13:52:19: 11%|█ | 11/100 [00:00<00:00, 1244.23 it/sec, obj=-2.8] INFO - 13:52:19: 12%|█▏ | 12/100 [00:00<00:00, 1270.87 it/sec, obj=-1.31] INFO - 13:52:19: 13%|█▎ | 13/100 [00:00<00:00, 1294.60 it/sec, obj=1.1] INFO - 13:52:19: 14%|█▍ | 14/100 [00:00<00:00, 1315.36 it/sec, obj=0.38] INFO - 13:52:19: 15%|█▌ | 15/100 [00:00<00:00, 1334.21 it/sec, obj=1.68] INFO - 13:52:19: 16%|█▌ | 16/100 [00:00<00:00, 1351.26 it/sec, obj=0.672] INFO - 13:52:19: 17%|█▋ | 17/100 [00:00<00:00, 1362.18 it/sec, obj=0.643] INFO - 13:52:19: 18%|█▊ | 18/100 [00:00<00:00, 1375.51 it/sec, obj=0.568] INFO - 13:52:19: 19%|█▉ | 19/100 [00:00<00:00, 1388.21 it/sec, obj=-0.277] INFO - 13:52:19: 20%|██ | 20/100 [00:00<00:00, 1400.01 it/sec, obj=1.51] INFO - 13:52:19: 21%|██ | 21/100 [00:00<00:00, 1411.02 it/sec, obj=1.83] INFO - 13:52:19: 22%|██▏ | 22/100 [00:00<00:00, 1420.94 it/sec, obj=2.12] INFO - 13:52:19: 23%|██▎ | 23/100 [00:00<00:00, 1427.10 it/sec, obj=0.526] INFO - 13:52:19: 24%|██▍ | 24/100 [00:00<00:00, 1434.67 it/sec, obj=1.47] INFO - 13:52:19: 25%|██▌ | 25/100 [00:00<00:00, 1442.43 it/sec, obj=-1.49] INFO - 13:52:19: 26%|██▌ | 26/100 [00:00<00:00, 1450.10 it/sec, obj=-1.58] INFO - 13:52:19: 27%|██▋ | 27/100 [00:00<00:00, 1456.94 it/sec, obj=1.59] INFO - 13:52:19: 28%|██▊ | 28/100 [00:00<00:00, 1463.36 it/sec, obj=0.329] INFO - 13:52:19: 29%|██▉ | 29/100 [00:00<00:00, 1469.46 it/sec, obj=-1.46] INFO - 13:52:19: 30%|███ | 30/100 [00:00<00:00, 1471.27 it/sec, obj=-0.045] INFO - 13:52:19: 31%|███ | 31/100 [00:00<00:00, 1477.99 it/sec, obj=-0.736] INFO - 13:52:19: 32%|███▏ | 32/100 [00:00<00:00, 1483.04 it/sec, obj=0.867] INFO - 13:52:19: 33%|███▎ | 33/100 [00:00<00:00, 1487.92 it/sec, obj=-3.12] INFO - 13:52:19: 34%|███▍ | 34/100 [00:00<00:00, 1492.53 it/sec, obj=-0.252] INFO - 13:52:19: 35%|███▌ | 35/100 [00:00<00:00, 1497.03 it/sec, obj=1.46] INFO - 13:52:19: 36%|███▌ | 36/100 [00:00<00:00, 1501.35 it/sec, obj=-2.02] INFO - 13:52:19: 37%|███▋ | 37/100 [00:00<00:00, 1500.99 it/sec, obj=-1.68] INFO - 13:52:19: 38%|███▊ | 38/100 [00:00<00:00, 1504.73 it/sec, obj=-0.913] INFO - 13:52:19: 39%|███▉ | 39/100 [00:00<00:00, 1508.46 it/sec, obj=-2.38] INFO - 13:52:19: 40%|████ | 40/100 [00:00<00:00, 1512.01 it/sec, obj=1.07] INFO - 13:52:19: 41%|████ | 41/100 [00:00<00:00, 1515.39 it/sec, obj=3.77] INFO - 13:52:19: 42%|████▏ | 42/100 [00:00<00:00, 1518.76 it/sec, obj=-1.88] INFO - 13:52:19: 43%|████▎ | 43/100 [00:00<00:00, 1519.41 it/sec, obj=0.116] INFO - 13:52:19: 44%|████▍ | 44/100 [00:00<00:00, 1522.04 it/sec, obj=-1.51] INFO - 13:52:19: 45%|████▌ | 45/100 [00:00<00:00, 1524.76 it/sec, obj=-0.0194] INFO - 13:52:19: 46%|████▌ | 46/100 [00:00<00:00, 1527.71 it/sec, obj=0.984] INFO - 13:52:19: 47%|████▋ | 47/100 [00:00<00:00, 1530.48 it/sec, obj=-0.34] INFO - 13:52:19: 48%|████▊ | 48/100 [00:00<00:00, 1525.79 it/sec, obj=-0.941] INFO - 13:52:19: 49%|████▉ | 49/100 [00:00<00:00, 1525.91 it/sec, obj=0.363] INFO - 13:52:19: 50%|█████ | 50/100 [00:00<00:00, 1527.81 it/sec, obj=-1.01] INFO - 13:52:19: 51%|█████ | 51/100 [00:00<00:00, 1530.28 it/sec, obj=-0.359] INFO - 13:52:19: 52%|█████▏ | 52/100 [00:00<00:00, 1532.51 it/sec, obj=-3.06] INFO - 13:52:19: 53%|█████▎ | 53/100 [00:00<00:00, 1534.86 it/sec, obj=2.34] INFO - 13:52:19: 54%|█████▍ | 54/100 [00:00<00:00, 1537.12 it/sec, obj=-0.262] INFO - 13:52:19: 55%|█████▌ | 55/100 [00:00<00:00, 1539.19 it/sec, obj=0.812] INFO - 13:52:19: 56%|█████▌ | 56/100 [00:00<00:00, 1539.01 it/sec, obj=-2.47] INFO - 13:52:19: 57%|█████▋ | 57/100 [00:00<00:00, 1540.68 it/sec, obj=1.49] INFO - 13:52:19: 58%|█████▊ | 58/100 [00:00<00:00, 1542.48 it/sec, obj=0.268] INFO - 13:52:19: 59%|█████▉ | 59/100 [00:00<00:00, 1544.37 it/sec, obj=0.559] INFO - 13:52:19: 60%|██████ | 60/100 [00:00<00:00, 1546.26 it/sec, obj=-2.01] INFO - 13:52:19: 61%|██████ | 61/100 [00:00<00:00, 1548.08 it/sec, obj=-0.854] INFO - 13:52:19: 62%|██████▏ | 62/100 [00:00<00:00, 1549.78 it/sec, obj=1.61] INFO - 13:52:19: 63%|██████▎ | 63/100 [00:00<00:00, 1549.70 it/sec, obj=-2.64] INFO - 13:52:19: 64%|██████▍ | 64/100 [00:00<00:00, 1551.21 it/sec, obj=0.818] INFO - 13:52:19: 65%|██████▌ | 65/100 [00:00<00:00, 1552.81 it/sec, obj=1.04] INFO - 13:52:19: 66%|██████▌ | 66/100 [00:00<00:00, 1554.42 it/sec, obj=-0.832] INFO - 13:52:19: 67%|██████▋ | 67/100 [00:00<00:00, 1555.92 it/sec, obj=0.692] INFO - 13:52:19: 68%|██████▊ | 68/100 [00:00<00:00, 1557.47 it/sec, obj=-3.33] INFO - 13:52:19: 69%|██████▉ | 69/100 [00:00<00:00, 1557.43 it/sec, obj=0.47] INFO - 13:52:19: 70%|███████ | 70/100 [00:00<00:00, 1558.66 it/sec, obj=0.445] INFO - 13:52:19: 71%|███████ | 71/100 [00:00<00:00, 1560.05 it/sec, obj=0.402] INFO - 13:52:19: 72%|███████▏ | 72/100 [00:00<00:00, 1561.38 it/sec, obj=2.77] INFO - 13:52:19: 73%|███████▎ | 73/100 [00:00<00:00, 1562.63 it/sec, obj=-0.256] INFO - 13:52:19: 74%|███████▍ | 74/100 [00:00<00:00, 1563.90 it/sec, obj=3.36] INFO - 13:52:19: 75%|███████▌ | 75/100 [00:00<00:00, 1565.16 it/sec, obj=-0.229] INFO - 13:52:19: 76%|███████▌ | 76/100 [00:00<00:00, 1564.92 it/sec, obj=-0.739] INFO - 13:52:19: 77%|███████▋ | 77/100 [00:00<00:00, 1565.89 it/sec, obj=0.808] INFO - 13:52:19: 78%|███████▊ | 78/100 [00:00<00:00, 1566.88 it/sec, obj=-0.377] INFO - 13:52:19: 79%|███████▉ | 79/100 [00:00<00:00, 1568.02 it/sec, obj=0.708] INFO - 13:52:19: 80%|████████ | 80/100 [00:00<00:00, 1569.14 it/sec, obj=-0.874] INFO - 13:52:19: 81%|████████ | 81/100 [00:00<00:00, 1570.20 it/sec, obj=-1.29] INFO - 13:52:19: 82%|████████▏ | 82/100 [00:00<00:00, 1570.06 it/sec, obj=0.505] INFO - 13:52:19: 83%|████████▎ | 83/100 [00:00<00:00, 1570.90 it/sec, obj=1.99] INFO - 13:52:19: 84%|████████▍ | 84/100 [00:00<00:00, 1571.92 it/sec, obj=0.574] INFO - 13:52:19: 85%|████████▌ | 85/100 [00:00<00:00, 1572.93 it/sec, obj=-2.06] INFO - 13:52:19: 86%|████████▌ | 86/100 [00:00<00:00, 1573.85 it/sec, obj=-1.49] INFO - 13:52:19: 87%|████████▋ | 87/100 [00:00<00:00, 1574.89 it/sec, obj=0.61] INFO - 13:52:19: 88%|████████▊ | 88/100 [00:00<00:00, 1575.86 it/sec, obj=0.542] INFO - 13:52:19: 89%|████████▉ | 89/100 [00:00<00:00, 1575.64 it/sec, obj=-1.5] INFO - 13:52:19: 90%|█████████ | 90/100 [00:00<00:00, 1576.38 it/sec, obj=0.201] INFO - 13:52:19: 91%|█████████ | 91/100 [00:00<00:00, 1577.20 it/sec, obj=0.949] INFO - 13:52:19: 92%|█████████▏| 92/100 [00:00<00:00, 1578.06 it/sec, obj=-1.86] INFO - 13:52:19: 93%|█████████▎| 93/100 [00:00<00:00, 1578.82 it/sec, obj=-0.0722] INFO - 13:52:19: 94%|█████████▍| 94/100 [00:00<00:00, 1579.63 it/sec, obj=-0.407] INFO - 13:52:19: 95%|█████████▌| 95/100 [00:00<00:00, 1579.61 it/sec, obj=0.194] INFO - 13:52:19: 96%|█████████▌| 96/100 [00:00<00:00, 1580.23 it/sec, obj=-0.207] INFO - 13:52:19: 97%|█████████▋| 97/100 [00:00<00:00, 1581.10 it/sec, obj=0.462] INFO - 13:52:19: 98%|█████████▊| 98/100 [00:00<00:00, 1581.39 it/sec, obj=-2.37] INFO - 13:52:19: 99%|█████████▉| 99/100 [00:00<00:00, 1582.11 it/sec, obj=1.32] INFO - 13:52:19: 100%|██████████| 100/100 [00:00<00:00, 1582.88 it/sec, obj=-2.21] INFO - 13:52:19: Optimization result: INFO - 13:52:19: Optimizer info: INFO - 13:52:19: Status: None INFO - 13:52:19: Message: None INFO - 13:52:19: Number of calls to the objective function by the optimizer: 100 INFO - 13:52:19: Solution: INFO - 13:52:19: Objective: -3.3284373246961634 INFO - 13:52:19: Design space: INFO - 13:52:19: +------+-------------+--------------------+-------------+-------+-------------------------+ INFO - 13:52:19: | Name | Lower bound | Value | Upper bound | Type | Distribution | INFO - 13:52:19: +------+-------------+--------------------+-------------+-------+-------------------------+ INFO - 13:52:19: | x | -2 | -1.959995425007306 | 2 | float | | INFO - 13:52:19: | y | -inf | -1.368441899688857 | inf | float | norm(mu=0.0, sigma=1.0) | INFO - 13:52:19: +------+-------------+--------------------+-------------+-------+-------------------------+ INFO - 13:52:19: *** End DOEScenario execution (time: 0:00:00.088497) *** {'eval_jac': False, 'n_samples': 100, 'algo': 'lhs'} .. GENERATED FROM PYTHON SOURCE LINES 150-151 We can export the optimization problem to a :class:`.Dataset`: .. GENERATED FROM PYTHON SOURCE LINES 151-153 .. code-block:: Python dataset = scenario.to_dataset(name="samples") .. GENERATED FROM PYTHON SOURCE LINES 154-155 and visualize it in a tabular way: .. GENERATED FROM PYTHON SOURCE LINES 155-157 .. code-block:: Python dataset .. raw:: html
GROUP designs functions
VARIABLE x y z
COMPONENT 0 0 0
1 1.869403 1.246453 3.115855
2 -1.567970 3.285041 1.717071
3 0.282640 -0.101706 0.180934
4 1.916313 1.848317 3.764630
5 1.562653 0.586038 2.148691
... ... ... ...
6 0.120633 -0.327477 -0.206844
7 -0.999225 1.461403 0.462178
8 -1.396066 -0.972779 -2.368845
9 1.090093 0.225565 1.315658
10 -1.433207 -0.779330 -2.212536

100 rows × 3 columns



.. GENERATED FROM PYTHON SOURCE LINES 158-160 or with a graphical post-processing, e.g. a scatter plot matrix: .. GENERATED FROM PYTHON SOURCE LINES 160-162 .. code-block:: Python ScatterMatrix(dataset).execute(save=False, show=True) .. image-sg:: /examples/uncertainty/images/sphx_glr_plot_u_parameter_space_001.png :alt: plot u parameter space :srcset: /examples/uncertainty/images/sphx_glr_plot_u_parameter_space_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [
] .. GENERATED FROM PYTHON SOURCE LINES 163-167 Sample a discipline over the uncertain space -------------------------------------------- If we want to sample a discipline over the uncertain space, we need to extract it: .. GENERATED FROM PYTHON SOURCE LINES 167-169 .. code-block:: Python uncertain_space = parameter_space.extract_uncertain_space() .. GENERATED FROM PYTHON SOURCE LINES 170-172 Then, we clear the cache, create a new scenario from this parameter space containing only the uncertain variables and execute it. .. GENERATED FROM PYTHON SOURCE LINES 172-177 .. code-block:: Python scenario = create_scenario( [discipline], "DisciplinaryOpt", "z", uncertain_space, scenario_type="DOE" ) scenario.execute({"algo": "lhs", "n_samples": 100}) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 13:52:20: INFO - 13:52:20: *** Start DOEScenario execution *** INFO - 13:52:20: DOEScenario INFO - 13:52:20: Disciplines: AnalyticDiscipline INFO - 13:52:20: MDO formulation: DisciplinaryOpt INFO - 13:52:20: Optimization problem: INFO - 13:52:20: minimize z(y) INFO - 13:52:20: with respect to y INFO - 13:52:20: over the design space: INFO - 13:52:20: +------+-------------------------+ INFO - 13:52:20: | Name | Distribution | INFO - 13:52:20: +------+-------------------------+ INFO - 13:52:20: | y | norm(mu=0.0, sigma=1.0) | INFO - 13:52:20: +------+-------------------------+ INFO - 13:52:20: Solving optimization problem with algorithm lhs: INFO - 13:52:20: 1%| | 1/100 [00:00<00:00, 1480.52 it/sec, obj=-0.641] INFO - 13:52:20: 2%|▏ | 2/100 [00:00<00:00, 1457.62 it/sec, obj=-0.394] INFO - 13:52:20: 3%|▎ | 3/100 [00:00<00:00, 1505.13 it/sec, obj=0.551] INFO - 13:52:20: 4%|▍ | 4/100 [00:00<00:00, 1535.53 it/sec, obj=0.944] INFO - 13:52:20: 5%|▌ | 5/100 [00:00<00:00, 1557.02 it/sec, obj=-2.12] INFO - 13:52:20: 6%|▌ | 6/100 [00:00<00:00, 1568.84 it/sec, obj=-1.64] INFO - 13:52:20: 7%|▋ | 7/100 [00:00<00:00, 1579.27 it/sec, obj=0.656] INFO - 13:52:20: 8%|▊ | 8/100 [00:00<00:00, 1572.81 it/sec, obj=-0.612] INFO - 13:52:20: 9%|▉ | 9/100 [00:00<00:00, 1580.04 it/sec, obj=0.736] INFO - 13:52:20: 10%|█ | 10/100 [00:00<00:00, 1586.11 it/sec, obj=0.36] INFO - 13:52:20: 11%|█ | 11/100 [00:00<00:00, 1591.71 it/sec, obj=-0.31] INFO - 13:52:20: 12%|█▏ | 12/100 [00:00<00:00, 1595.60 it/sec, obj=0.324] INFO - 13:52:20: 13%|█▎ | 13/100 [00:00<00:00, 1599.05 it/sec, obj=-1.73] INFO - 13:52:20: 14%|█▍ | 14/100 [00:00<00:00, 1596.14 it/sec, obj=0.494] INFO - 13:52:20: 15%|█▌ | 15/100 [00:00<00:00, 1597.46 it/sec, obj=-0.148] INFO - 13:52:20: 16%|█▌ | 16/100 [00:00<00:00, 1599.24 it/sec, obj=1.1] INFO - 13:52:20: 17%|█▋ | 17/100 [00:00<00:00, 1601.63 it/sec, obj=-0.716] INFO - 13:52:20: 18%|█▊ | 18/100 [00:00<00:00, 1598.68 it/sec, obj=0.0421] INFO - 13:52:20: 19%|█▉ | 19/100 [00:00<00:00, 1597.96 it/sec, obj=0.256] INFO - 13:52:20: 20%|██ | 20/100 [00:00<00:00, 1596.19 it/sec, obj=-1.45] INFO - 13:52:20: 21%|██ | 21/100 [00:00<00:00, 1592.83 it/sec, obj=0.637] INFO - 13:52:20: 22%|██▏ | 22/100 [00:00<00:00, 1594.32 it/sec, obj=1.97] INFO - 13:52:20: 23%|██▎ | 23/100 [00:00<00:00, 1596.35 it/sec, obj=-0.208] INFO - 13:52:20: 24%|██▍ | 24/100 [00:00<00:00, 1598.13 it/sec, obj=0.18] INFO - 13:52:20: 25%|██▌ | 25/100 [00:00<00:00, 1599.73 it/sec, obj=0.000485] INFO - 13:52:20: 26%|██▌ | 26/100 [00:00<00:00, 1601.26 it/sec, obj=1.17] INFO - 13:52:20: 27%|██▋ | 27/100 [00:00<00:00, 1599.48 it/sec, obj=-0.305] INFO - 13:52:20: 28%|██▊ | 28/100 [00:00<00:00, 1600.25 it/sec, obj=0.68] INFO - 13:52:20: 29%|██▉ | 29/100 [00:00<00:00, 1601.81 it/sec, obj=-0.932] INFO - 13:52:20: 30%|███ | 30/100 [00:00<00:00, 1603.35 it/sec, obj=0.901] INFO - 13:52:20: 31%|███ | 31/100 [00:00<00:00, 1604.28 it/sec, obj=0.454] INFO - 13:52:20: 32%|███▏ | 32/100 [00:00<00:00, 1605.36 it/sec, obj=-1.16] INFO - 13:52:20: 33%|███▎ | 33/100 [00:00<00:00, 1606.16 it/sec, obj=1.44] INFO - 13:52:20: 34%|███▍ | 34/100 [00:00<00:00, 1603.83 it/sec, obj=0.798] INFO - 13:52:20: 35%|███▌ | 35/100 [00:00<00:00, 1602.63 it/sec, obj=1.59] INFO - 13:52:20: 36%|███▌ | 36/100 [00:00<00:00, 1603.28 it/sec, obj=2.05] INFO - 13:52:20: 37%|███▋ | 37/100 [00:00<00:00, 1604.29 it/sec, obj=-0.26] INFO - 13:52:20: 38%|███▊ | 38/100 [00:00<00:00, 1605.17 it/sec, obj=0.874] INFO - 13:52:20: 39%|███▉ | 39/100 [00:00<00:00, 1606.18 it/sec, obj=0.832] INFO - 13:52:20: 40%|████ | 40/100 [00:00<00:00, 1604.35 it/sec, obj=-1.38] INFO - 13:52:20: 41%|████ | 41/100 [00:00<00:00, 1605.00 it/sec, obj=1.52] INFO - 13:52:20: 42%|████▏ | 42/100 [00:00<00:00, 1605.99 it/sec, obj=-0.522] INFO - 13:52:20: 43%|████▎ | 43/100 [00:00<00:00, 1606.88 it/sec, obj=1.4] INFO - 13:52:20: 44%|████▍ | 44/100 [00:00<00:00, 1607.91 it/sec, obj=-0.484] INFO - 13:52:20: 45%|████▌ | 45/100 [00:00<00:00, 1608.75 it/sec, obj=-0.91] INFO - 13:52:20: 46%|████▌ | 46/100 [00:00<00:00, 1609.56 it/sec, obj=0.343] INFO - 13:52:20: 47%|████▋ | 47/100 [00:00<00:00, 1607.20 it/sec, obj=-0.441] INFO - 13:52:20: 48%|████▊ | 48/100 [00:00<00:00, 1607.83 it/sec, obj=-0.871] INFO - 13:52:20: 49%|████▉ | 49/100 [00:00<00:00, 1608.72 it/sec, obj=2.67] INFO - 13:52:20: 50%|█████ | 50/100 [00:00<00:00, 1609.45 it/sec, obj=0.217] INFO - 13:52:20: 51%|█████ | 51/100 [00:00<00:00, 1610.18 it/sec, obj=-0.425] INFO - 13:52:20: 52%|█████▏ | 52/100 [00:00<00:00, 1611.08 it/sec, obj=0.113] INFO - 13:52:20: 53%|█████▎ | 53/100 [00:00<00:00, 1609.62 it/sec, obj=-0.377] INFO - 13:52:20: 54%|█████▍ | 54/100 [00:00<00:00, 1611.60 it/sec, obj=-1.19] INFO - 13:52:20: 55%|█████▌ | 55/100 [00:00<00:00, 1613.02 it/sec, obj=-0.528] INFO - 13:52:20: 56%|█████▌ | 56/100 [00:00<00:00, 1613.67 it/sec, obj=-2.64] INFO - 13:52:20: 57%|█████▋ | 57/100 [00:00<00:00, 1614.19 it/sec, obj=-0.0776] INFO - 13:52:20: 58%|█████▊ | 58/100 [00:00<00:00, 1614.85 it/sec, obj=1.08] INFO - 13:52:20: 59%|█████▉ | 59/100 [00:00<00:00, 1615.44 it/sec, obj=-2.05] INFO - 13:52:20: 60%|██████ | 60/100 [00:00<00:00, 1613.99 it/sec, obj=0.0555] INFO - 13:52:20: 61%|██████ | 61/100 [00:00<00:00, 1614.48 it/sec, obj=-1.84] INFO - 13:52:20: 62%|██████▏ | 62/100 [00:00<00:00, 1615.07 it/sec, obj=0.4] INFO - 13:52:20: 63%|██████▎ | 63/100 [00:00<00:00, 1608.39 it/sec, obj=-0.195] INFO - 13:52:20: 64%|██████▍ | 64/100 [00:00<00:00, 1602.40 it/sec, obj=-0.578] INFO - 13:52:20: 65%|██████▌ | 65/100 [00:00<00:00, 1601.73 it/sec, obj=-0.977] INFO - 13:52:20: 66%|██████▌ | 66/100 [00:00<00:00, 1600.44 it/sec, obj=-0.114] INFO - 13:52:20: 67%|██████▋ | 67/100 [00:00<00:00, 1601.03 it/sec, obj=0.587] INFO - 13:52:20: 68%|██████▊ | 68/100 [00:00<00:00, 1601.63 it/sec, obj=-0.0679] INFO - 13:52:20: 69%|██████▉ | 69/100 [00:00<00:00, 1602.37 it/sec, obj=-0.0218] INFO - 13:52:20: 70%|███████ | 70/100 [00:00<00:00, 1602.90 it/sec, obj=-0.228] INFO - 13:52:20: 71%|███████ | 71/100 [00:00<00:00, 1603.46 it/sec, obj=1.21] INFO - 13:52:20: 72%|███████▏ | 72/100 [00:00<00:00, 1601.93 it/sec, obj=-0.34] INFO - 13:52:20: 73%|███████▎ | 73/100 [00:00<00:00, 1603.35 it/sec, obj=0.513] INFO - 13:52:20: 74%|███████▍ | 74/100 [00:00<00:00, 1604.31 it/sec, obj=1.67] INFO - 13:52:20: 75%|███████▌ | 75/100 [00:00<00:00, 1604.82 it/sec, obj=0.557] INFO - 13:52:20: 76%|███████▌ | 76/100 [00:00<00:00, 1605.39 it/sec, obj=0.431] INFO - 13:52:20: 77%|███████▋ | 77/100 [00:00<00:00, 1605.80 it/sec, obj=-1.31] INFO - 13:52:20: 78%|███████▊ | 78/100 [00:00<00:00, 1601.04 it/sec, obj=-0.678] INFO - 13:52:20: 79%|███████▉ | 79/100 [00:00<00:00, 1594.59 it/sec, obj=-1.01] INFO - 13:52:20: 80%|████████ | 80/100 [00:00<00:00, 1594.16 it/sec, obj=0.246] INFO - 13:52:20: 81%|████████ | 81/100 [00:00<00:00, 1594.67 it/sec, obj=1.29] INFO - 13:52:20: 82%|████████▏ | 82/100 [00:00<00:00, 1595.30 it/sec, obj=0.75] INFO - 13:52:20: 83%|████████▎ | 83/100 [00:00<00:00, 1595.80 it/sec, obj=-1.54] INFO - 13:52:20: 84%|████████▍ | 84/100 [00:00<00:00, 1592.36 it/sec, obj=-0.156] INFO - 13:52:20: 85%|████████▌ | 85/100 [00:00<00:00, 1592.92 it/sec, obj=1.87] INFO - 13:52:20: 86%|████████▌ | 86/100 [00:00<00:00, 1593.36 it/sec, obj=-1.08] INFO - 13:52:20: 87%|████████▋ | 87/100 [00:00<00:00, 1593.96 it/sec, obj=-0.647] INFO - 13:52:20: 88%|████████▊ | 88/100 [00:00<00:00, 1594.52 it/sec, obj=0.968] INFO - 13:52:20: 89%|████████▉ | 89/100 [00:00<00:00, 1585.94 it/sec, obj=-0.773] INFO - 13:52:20: 90%|█████████ | 90/100 [00:00<00:00, 1584.84 it/sec, obj=1.26] INFO - 13:52:20: 91%|█████████ | 91/100 [00:00<00:00, 1586.05 it/sec, obj=0.166] INFO - 13:52:20: 92%|█████████▏| 92/100 [00:00<00:00, 1586.95 it/sec, obj=0.29] INFO - 13:52:20: 93%|█████████▎| 93/100 [00:00<00:00, 1587.36 it/sec, obj=0.127] INFO - 13:52:20: 94%|█████████▍| 94/100 [00:00<00:00, 1587.90 it/sec, obj=-1.26] INFO - 13:52:20: 95%|█████████▌| 95/100 [00:00<00:00, 1588.41 it/sec, obj=1.01] INFO - 13:52:20: 96%|█████████▌| 96/100 [00:00<00:00, 1588.93 it/sec, obj=0.0819] INFO - 13:52:20: 97%|█████████▋| 97/100 [00:00<00:00, 1588.43 it/sec, obj=-1.09] INFO - 13:52:20: 98%|█████████▊| 98/100 [00:00<00:00, 1588.77 it/sec, obj=-0.762] INFO - 13:52:20: 99%|█████████▉| 99/100 [00:00<00:00, 1589.26 it/sec, obj=-0.0429] INFO - 13:52:20: 100%|██████████| 100/100 [00:00<00:00, 1589.73 it/sec, obj=-0.813] INFO - 13:52:20: Optimization result: INFO - 13:52:20: Optimizer info: INFO - 13:52:20: Status: None INFO - 13:52:20: Message: None INFO - 13:52:20: Number of calls to the objective function by the optimizer: 100 INFO - 13:52:20: Solution: INFO - 13:52:20: Objective: -2.6379682068246657 INFO - 13:52:20: Design space: INFO - 13:52:20: +------+-------------------------+ INFO - 13:52:20: | Name | Distribution | INFO - 13:52:20: +------+-------------------------+ INFO - 13:52:20: | y | norm(mu=0.0, sigma=1.0) | INFO - 13:52:20: +------+-------------------------+ INFO - 13:52:20: *** End DOEScenario execution (time: 0:00:00.086388) *** {'eval_jac': False, 'n_samples': 100, 'algo': 'lhs'} .. GENERATED FROM PYTHON SOURCE LINES 178-183 Finally, we build a dataset from the disciplinary cache and visualize it. We can see that the deterministic variable 'x' is set to its default value for all evaluations, contrary to the previous case where we were considering the whole parameter space: .. GENERATED FROM PYTHON SOURCE LINES 183-185 .. code-block:: Python dataset = scenario.to_dataset(name="samples") dataset .. raw:: html
GROUP designs functions
VARIABLE y z
COMPONENT 0 0
1 -0.640726 -0.640726
2 -0.393653 -0.393653
3 0.550565 0.550565
4 0.944369 0.944369
5 -2.115275 -2.115275
... ... ...
6 0.081947 0.081947
7 -1.085812 -1.085812
8 -0.761651 -0.761651
9 -0.042932 -0.042932
10 -0.813354 -0.813354

100 rows × 2 columns



.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.668 seconds) .. _sphx_glr_download_examples_uncertainty_plot_u_parameter_space.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_u_parameter_space.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_u_parameter_space.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_