.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/sensitivity/morris/plot_morris_nonlinearities.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 or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_sensitivity_morris_plot_morris_nonlinearities.py: Function with nonlinearities / parameter dependencies ================================================================= .. math:: Y = h(X) = 0.01 X_{1} + 1.0 X_{2} + 0.4 X_{3}^{2} + X_{4} X_{5} ranking of input parameters: - :math:`X_{1}` is non-influential - :math:`X_{2}` is influential, linear/additive effect (expect large :math:`\mu^{\star}` and small :math:`\sigma`) - :math:`X_{3}` is somewhat influential, nonlinear effect, - :math:`X_{4}, X_{5}` are influential with dependence .. GENERATED FROM PYTHON SOURCE LINES 18-19 Initially we have to import the necessary modules. .. GENERATED FROM PYTHON SOURCE LINES 22-30 .. code-block:: default import shutil from UQpy.run_model.RunModel import RunModel from UQpy.run_model.model_execution.PythonModel import PythonModel from UQpy.distributions import Uniform from UQpy.sensitivity import MorrisSensitivity import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 31-32 Set-up problem with g-function. .. GENERATED FROM PYTHON SOURCE LINES 35-59 .. code-block:: default model = PythonModel(model_script='local_pfn.py', model_object_name='fun2_sensitivity', delete_files=True, var_names=['X{}'.format(i) for i in range(5)]) runmodel_object = RunModel(model=model) dist_object = [Uniform(), ] * 5 sens = MorrisSensitivity(runmodel_object=runmodel_object, distributions=dist_object, n_levels=20, maximize_dispersion=True) sens.run(n_trajectories=10) fig, ax = plt.subplots(figsize=(5, 3.5)) ax.scatter(sens.mustar_indices, sens.sigma_indices, s=60) for i, (mu, sig) in enumerate(zip(sens.mustar_indices, sens.sigma_indices)): ax.text(x=mu + 0.01, y=sig + 0.01, s='X{}'.format(i + 1), fontsize=14) ax.set_xlabel(r'$\mu^{\star}$', fontsize=18) ax.set_ylabel(r'$\sigma$', fontsize=18) # ax.set_title('Morris sensitivity indices', fontsize=16) plt.show() .. image-sg:: /auto_examples/sensitivity/morris/images/sphx_glr_plot_morris_nonlinearities_001.png :alt: plot morris nonlinearities :srcset: /auto_examples/sensitivity/morris/images/sphx_glr_plot_morris_nonlinearities_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.986 seconds) .. _sphx_glr_download_auto_examples_sensitivity_morris_plot_morris_nonlinearities.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/SURGroup/UQpy/master?urlpath=lab/tree/notebooks/auto_examples/sensitivity/morris/plot_morris_nonlinearities.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_morris_nonlinearities.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_morris_nonlinearities.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_