.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/sensitivity/chatterjee/chatterjee_exponential.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_exponential.py: Exponential function ============================================== The exponential function was used in [1]_ to demonstrate the Cramér-von Mises indices. Chattererjee indices approach the Cramér-von Mises indices in the sample limit and will be demonstrated via this example. .. math:: f(x) := \exp(x_1 + 2x_2), \quad x_1, x_2 \sim \mathcal{N}(0, 1) .. [1] Gamboa, F., Klein, T., & Lagnoux, A. (2018). Sensitivity Analysis Based on Cramér-von Mises Distance. SIAM/ASA Journal on Uncertainty Quantification, 6(2), 522-548. doi:10.1137/15M1025621. (`Link `_) .. GENERATED FROM PYTHON SOURCE LINES 20-29 .. code-block:: default from UQpy.run_model.RunModel import RunModel from UQpy.run_model.model_execution.PythonModel import PythonModel from UQpy.distributions import Normal 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-48 .. code-block:: default # Create Model object model = PythonModel( model_script="local_exponential.py", model_object_name="evaluate", var_names=[ "X_1", "X_2", ], delete_files=True, ) runmodel_obj = RunModel(model=model) # Define distribution object dist_object = JointIndependent([Normal(0, 1)] * 2) .. GENERATED FROM PYTHON SOURCE LINES 49-50 **Compute Chatterjee indices** .. GENERATED FROM PYTHON SOURCE LINES 52-57 .. code-block:: default SA = ChatterjeeSensitivity(runmodel_obj, dist_object) # Compute Chatterjee indices using the pick and freeze algorithm SA.run(n_samples=1_000_000) .. GENERATED FROM PYTHON SOURCE LINES 58-67 **Chattererjee indices** Chattererjee indices approach the Cramér-von Mises indices in the sample limit. Expected value of the sensitivity indices: :math:`S^1_{CVM} = \frac{6}{\pi} \operatorname{arctan}(2) - 2 \approx 0.1145` :math:`S^2_{CVM} = \frac{6}{\pi} \operatorname{arctan}(\sqrt{19}) - 2 \approx 0.5693` .. GENERATED FROM PYTHON SOURCE LINES 69-77 .. code-block:: default SA.first_order_chatterjee_indices # **Plot the Chatterjee indices** fig1, ax1 = plot_sensitivity_index( SA.first_order_chatterjee_indices[:, 0], plot_title="Chatterjee indices", color="C2", ) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_sensitivity_chatterjee_chatterjee_exponential.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_exponential.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: chatterjee_exponential.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: chatterjee_exponential.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_