.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_reliability_sensitivity/reliability/plot_post_analytical_importance_sampling.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_reliability_plot_post_analytical_importance_sampling.py: Use the post-analytical importance sampling algorithm ===================================================== .. GENERATED FROM PYTHON SOURCE LINES 6-35 In this example we want to estimate the probability to exceed a threshold through the combination of approximation and simulation methods. - perform an FORM or SORM study in order to find the design point, - perform an importance sampling study centered around the design point: the importance distribution operates in the standard space and is the standard distribution of the standard space (the standard elliptical distribution in the case of an elliptic copula of the input random vector, the standard normal one in all the other cases). The importance sampling technique in the standard space may be of two kinds: - the sample is generated according to the new importance distribution: this technique is called post analytical importance sampling, - the sample is generated according to the new importance distribution and is controlled by the value of the linearized limit state function: this technique is called post analytical controlled importance sampling. This post analytical importance sampling algorithm is created from the result structure of a FORM or SORM algorithm. It is parameterized like other simulation algorithm, through the parameters OuterSampling, BlockSize, ... and provide the same type of results. Let us note that the post FORM/SORM importance sampling method may be implemented thanks to the ImportanceSampling object, where the importance distribution is defined in the standard space: then, it requires that the event initially defined in the pysical space be transformed in the standard space. The controlled importance sampling technique is only accessible within the post analytical context. .. GENERATED FROM PYTHON SOURCE LINES 37-41 .. code-block:: Python import openturns as ot ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 42-43 Create a model .. GENERATED FROM PYTHON SOURCE LINES 43-57 .. code-block:: Python model = ot.SymbolicFunction(["x1", "x2"], ["x1^2+x2"]) R = ot.CorrelationMatrix(2) R[0, 1] = -0.6 inputDist = ot.Normal([0.0, 0.0], R) inputDist.setDescription(["X1", "X2"]) inputVector = ot.RandomVector(inputDist) # Create the output random vector Y=model(X) Y = ot.CompositeRandomVector(model, inputVector) # Create the event Y > 4 threshold = 4.0 event = ot.ThresholdEvent(Y, ot.Greater(), threshold) .. GENERATED FROM PYTHON SOURCE LINES 58-59 Create a FORM algorithm .. GENERATED FROM PYTHON SOURCE LINES 59-67 .. code-block:: Python solver = ot.Cobyla() startingPoint = inputDist.getMean() algo = ot.FORM(solver, event, startingPoint) # Run the algorithm and retrieve the result algo.run() result_form = algo.getResult() .. GENERATED FROM PYTHON SOURCE LINES 68-69 Create the post analytical importance sampling simulation algorithm .. GENERATED FROM PYTHON SOURCE LINES 69-73 .. code-block:: Python algo = ot.PostAnalyticalImportanceSampling(result_form) algo.run() algo.getResult() .. raw:: html
probabilityEstimate=3.899867e-02 varianceEstimate=1.519324e-05 standard deviation=3.90e-03 coefficient of variation=9.99e-02 confidenceLength(0.95)=1.53e-02 outerSampling=241 blockSize=1


.. GENERATED FROM PYTHON SOURCE LINES 74-75 Create the post analytical controlled importance sampling simulation algorithm .. GENERATED FROM PYTHON SOURCE LINES 75-78 .. code-block:: Python algo = ot.PostAnalyticalControlledImportanceSampling(result_form) algo.run() algo.getResult() .. raw:: html
probabilityEstimate=4.565267e-02 varianceEstimate=0.000000e+00 standard deviation=0.00e+00 coefficient of variation=0.00e+00 confidenceLength(0.95)=0.00e+00 outerSampling=2 blockSize=1


.. _sphx_glr_download_auto_reliability_sensitivity_reliability_plot_post_analytical_importance_sampling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_post_analytical_importance_sampling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_post_analytical_importance_sampling.py `