.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_reliability_sensitivity_sensitivity_analysis_plot_sensitivity_fast.py:
FAST sensitivity indices
========================
This example will demonstrate how to quantify the correlation between the input
variables and the output variable of a model using the FAST method,
based upon the Fourier decomposition of the model response,
which is a relevant alternative to the classical
simulation approach for computing Sobol sensitivity indices.
The FAST indices, like the Sobol indices, allow to
evaluate the importance of a single variable or a specific set of variables.
In theory, FAST indices range is :math:`\left[0; 1\right]` ; the closer to 1 the
index is, the greater the model response sensitivity to the variable is.
The FAST method compute the first and total order indices.
The first order indices evaluate the importance of one variable at a time
(:math:`d` indices, with :math:`d` the input dimension of the model).
The :math:`d` total indices give the relative importance of every variables except
the variable :math:`X_i`, for every variable.
.. code-block:: default
from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)
We load the :ref:`Ishigami model ` from the usecases module :
.. code-block:: default
from openturns.usecases import ishigami_function as ishigami_function
im = ishigami_function.IshigamiModel()
The `IshigamiModel` data class contains the input independent joint distribution :
.. code-block:: default
distribution = im.distributionX
and the Ishigami function :
.. code-block:: default
model = im.model
.. code-block:: default
size = 400
sensitivityAnalysis = ot.FAST(model, distribution, size)
# Compute the first order indices (first and total order indices are
# computed together)
firstOrderIndices = sensitivityAnalysis.getFirstOrderIndices()
# Retrieve total order indices
totalOrderIndices = sensitivityAnalysis.getTotalOrderIndices()
Print indices
.. code-block:: default
print('First order FAST indices:', firstOrderIndices)
print('Total order FAST indices:', totalOrderIndices)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
First order FAST indices: [0.307169,0.443297,2.1443e-06]
Total order FAST indices: [0.553559,0.487805,0.239566]
.. code-block:: default
graph = ot.SobolIndicesAlgorithm.DrawImportanceFactors(firstOrderIndices, distribution.getDescription(), 'FAST first order indices')
view = viewer.View(graph)
.. image:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_fast_001.png
:alt: FAST first order indices
:class: sphx-glr-single-img
.. code-block:: default
graph = ot.SobolIndicesAlgorithm.DrawImportanceFactors(totalOrderIndices, distribution.getDescription(), 'FAST total order indices')
view = viewer.View(graph)
plt.show()
.. image:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_fast_002.png
:alt: FAST total order indices
:class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.080 seconds)
.. _sphx_glr_download_auto_reliability_sensitivity_sensitivity_analysis_plot_sensitivity_fast.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_sensitivity_fast.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_sensitivity_fast.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_