.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/sensitivity/chatterjee/chatterjee_ishigami.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_chatterjee_chatterjee_ishigami.py: Ishigami function ============================================== The ishigami function is a non-linear, non-monotonic function that is commonly used to benchmark uncertainty and sensitivity analysis methods. .. math:: f(x_1, x_2, x_3) = sin(x_1) + a \cdot sin^2(x_2) + b \cdot x_3^4 sin(x_1) .. math:: x_1, x_2, x_3 \sim \mathcal{U}(-\pi, \pi), \quad a, b\in \mathbb{R} .. GENERATED FROM PYTHON SOURCE LINES 18-29 .. code-block:: default import numpy as np from UQpy.run_model.RunModel import RunModel from UQpy.run_model.model_execution.PythonModel import PythonModel from UQpy.distributions import Uniform from UQpy.distributions.collection.JointIndependent import JointIndependent from UQpy.sensitivity.ChatterjeeSensitivity import ChatterjeeSensitivity from UQpy.sensitivity.PostProcess import * np.random.seed(123) .. GENERATED FROM PYTHON SOURCE LINES 30-31 **Define the model and input distributions** .. GENERATED FROM PYTHON SOURCE LINES 31-46 .. code-block:: default # Create Model object model = PythonModel( model_script="local_ishigami.py", model_object_name="evaluate", var_names=[r"$X_1$", "$X_2$", "$X_3$"], delete_files=True, params=[7, 0.1], ) runmodel_obj = RunModel(model=model) # Define distribution object dist_object = JointIndependent([Uniform(-np.pi, 2 * np.pi)] * 3) .. GENERATED FROM PYTHON SOURCE LINES 47-48 **Compute Chatterjee indices** .. GENERATED FROM PYTHON SOURCE LINES 50-59 .. code-block:: default SA = ChatterjeeSensitivity(runmodel_obj, dist_object) SA.run( n_samples=100_000, estimate_sobol_indices=True, n_bootstrap_samples=100, confidence_level=0.95, ) .. GENERATED FROM PYTHON SOURCE LINES 60-61 **Chattererjee indices** .. GENERATED FROM PYTHON SOURCE LINES 63-65 .. code-block:: default SA.first_order_chatterjee_indices .. GENERATED FROM PYTHON SOURCE LINES 66-67 **Confidence intervals for the Chatterjee indices** .. GENERATED FROM PYTHON SOURCE LINES 69-79 .. code-block:: default SA.confidence_interval_chatterjee # **Plot the Chatterjee indices** fig1, ax1 = plot_sensitivity_index( SA.first_order_chatterjee_indices[:, 0], SA.confidence_interval_chatterjee, plot_title="Chatterjee indices", color="C2", ) .. GENERATED FROM PYTHON SOURCE LINES 80-89 **Estimated Sobol indices** Expected first order Sobol indices: :math:`S_1`: 0.3139 :math:`S_2`: 0.4424 :math:`S_3`: 0.0 .. GENERATED FROM PYTHON SOURCE LINES 91-99 .. code-block:: default SA.first_order_sobol_indices # **Plot the first order Sobol indices** fig2, ax2 = plot_sensitivity_index( SA.first_order_sobol_indices[:, 0], plot_title="First order Sobol indices", color="C0", ) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_sensitivity_chatterjee_chatterjee_ishigami.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/chatterjee/chatterjee_ishigami.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: chatterjee_ishigami.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: chatterjee_ishigami.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_