.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_reliability_sensitivity/design_of_experiments/plot_create_random_doe.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_auto_reliability_sensitivity_design_of_experiments_plot_create_random_doe.py: Create a random design of experiments ===================================== .. GENERATED FROM PYTHON SOURCE LINES 6-10 Abstract -------- Random designs of experiments can be generated from probability distributions. .. GENERATED FROM PYTHON SOURCE LINES 12-19 .. code-block:: Python import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 20-21 We create the underlying distribution: a standard 2-dimensional normal distribution. .. GENERATED FROM PYTHON SOURCE LINES 21-24 .. code-block:: Python distribution = ot.Normal(2) size = 50 .. GENERATED FROM PYTHON SOURCE LINES 25-29 The Monte Carlo design of experiments ------------------------------------- We build the experiment with the :class:`~openturns.MonteCarloExperiment` class : .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python experiment = ot.MonteCarloExperiment(distribution, size) sample = experiment.generate() .. GENERATED FROM PYTHON SOURCE LINES 33-34 We draw the design of experiments as a :class:`~openturns.Cloud` .. GENERATED FROM PYTHON SOURCE LINES 34-39 .. code-block:: Python graph = ot.Graph("Monte Carlo design", r"$x_1$", r"$x_2$", True, "") cloud = ot.Cloud(sample, "blue", "fsquare", "") graph.add(cloud) view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_001.png :alt: Monte Carlo design :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 40-44 Latin Hypercube Sampling ------------------------ We build the LHS design of experiments with the :class:`~openturns.LHSExperiment` class : .. GENERATED FROM PYTHON SOURCE LINES 44-47 .. code-block:: Python experiment = ot.LHSExperiment(distribution, size) sample = experiment.generate() .. GENERATED FROM PYTHON SOURCE LINES 48-49 We draw the LHS design of experiments as a cloud : .. GENERATED FROM PYTHON SOURCE LINES 49-54 .. code-block:: Python graph = ot.Graph("LHS design", r"$x_1$", r"$x_2$", True, "") cloud = ot.Cloud(sample, "blue", "fsquare", "") graph.add(cloud) view = viewer.View(graph) .. image-sg:: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_002.png :alt: LHS design :srcset: /auto_reliability_sensitivity/design_of_experiments/images/sphx_glr_plot_create_random_doe_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 55-56 Display figures .. GENERATED FROM PYTHON SOURCE LINES 56-57 .. code-block:: Python plt.show() .. _sphx_glr_download_auto_reliability_sensitivity_design_of_experiments_plot_create_random_doe.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_create_random_doe.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_create_random_doe.py `