Use the Importance Sampling algorithm

In this example we estimate a failure probability with the importance sampling simulation algorithm provided by the ImportanceSamplingExperiment class.

The main steps of this method are:

  • run a FORM analysis,

  • create an importance distribution based on the results of the FORM results,

  • run a sampling-based probability estimate algorithm.

We shall consider the analytical example of a cantilever beam.

Define the cantilever beam model

from openturns.usecases import cantilever_beam
import openturns as ot
import openturns.viewer as otv

The cantilever beam example can be accessed in the usecases module :

The joint probability distribution of the input parameters is stored in the object cb :

We create the model.

Define the event

We create the event whose probability we want to estimate.

Run a FORM analysis

Define a solver

Run FORM

Configure an importance sampling algorithm

The getStandardSpaceDesignPoint method returns the design point in the U-space.

class=Point name=Standard Space Design Point dimension=4 values=[-0.665638,4.31263,1.23029,-1.36892]


The key point is to define the importance distribution in the U-space. To define it, we use a multivariate standard Gaussian centered around the design point in the U-space.

dimension = distribution.getDimension()
dimension
4
Normal
  • name=Normal
  • dimension=4
  • range=]-inf (-8.31627), (6.98499) +inf[ ]-inf (-3.338), (11.9633) +inf[ ]-inf (-6.42034), (8.88092) +inf[ ]-inf (-9.01955), (6.28171) +inf[
  • description=[X0,X1,X2,X3]
  • parameter=[-0.665638,1,4.31263,1,1.23029,1,-1.36892,1,0,0,0,0,0,0]#14
  • parameterDescription=[mu_0,sigma_0,mu_1,sigma_1,mu_2,sigma_2,mu_3,sigma_3,R_1_0,R_2_0,R_2_1,R_3_0,R_3_1,R_3_2]#14
  • isParallel=true
  • isCopula=false
  • isContinuous=true
  • isDiscrete=false
  • isIntegral=false


Create the design of experiment corresponding to importance sampling. This generates a WeightedExperiment with weights fitting to the importance distribution.

Create the standard event corresponding to the event. This pushes the original problem to the U-space, with Gaussian independent marginals.

Run the importance sampling simulation

We then create the simulation algorithm.

We can retrieve results of this estimate :

result = algo.getResult()
probability = result.getProbabilityEstimate()
print("Probability = ", probability)
Probability =  4.5542223175708e-07

The confidence interval of level 95\% is:

ci95 = result.getProbabilityDistribution().computeBilateralConfidenceInterval(0.95)
print("Confidence interval (0.95) = ", ci95)
Confidence interval (0.95) =  [3.66495e-07, 5.44349e-07]

We can observe the convergence history of the estimate with the drawProbabilityConvergence method which displays the estimate and confidence interval evolution.

ProbabilitySimulationAlgorithm convergence graph at level 0.95