.. 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-25 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 27-31 .. code-block:: default import openturns as ot ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 32-33 Create a model .. GENERATED FROM PYTHON SOURCE LINES 33-47 .. code-block:: default 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 48-49 Create a FORM algorithm .. GENERATED FROM PYTHON SOURCE LINES 49-57 .. code-block:: default 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 58-59 Create the post analytical importance sampling simulation algorithm .. GENERATED FROM PYTHON SOURCE LINES 59-63 .. code-block:: default algo = ot.PostAnalyticalImportanceSampling(result_form) algo.run() algo.getResult() .. raw:: html

probabilityEstimate=5.309800e-02 varianceEstimate=2.787874e-05 standard deviation=5.28e-03 coefficient of variation=9.94e-02 confidenceLength(0.95)=2.07e-02 outerSampling=195 blockSize=1



.. GENERATED FROM PYTHON SOURCE LINES 64-65 Create the post analytical controlled importance sampling simulation algorithm .. GENERATED FROM PYTHON SOURCE LINES 65-68 .. code-block:: default 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



.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.005 seconds) .. _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-python :download:`Download Python source code: plot_post_analytical_importance_sampling.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_post_analytical_importance_sampling.ipynb `