RELIABILITY: ADVANCED ACTIVE LEARNING ON THE TWO-DIMENSIONAL HAT FUNCTION¶

In this example, it is shown how advanced options of active learning reliability can be set. Three cases are illustrated, each relating to a specific aspect of the framework:

  • Enrichment and convergence criteria
  • Surrogate model options
  • Reliability algorithms options

Package imports¶

In [1]:
from uqpylab import sessions

Start a remote UQCloud session¶

In [2]:
# Start the session
mySession = sessions.cloud()
# (Optional) Get a convenient handle to the command line interface
uq = mySession.cli
# Reset the session
mySession.reset()
Processing .
.
 done!

 uqpylab.sessions :: INFO     :: This is UQ[py]Lab, version 1.00, running on https://uqcloud.ethz.ch. 
                                 UQ[py]Lab is free software, published under the open source BSD 3-clause license.
                                 To request special permissions, please contact:
                                  - Stefano Marelli (marelli@ibk.baug.ethz.ch).
                                 A new session (7ee2d780742446bc92e8588cc4b6e61a) started.
 uqpylab.sessions :: INFO     :: Reset successful.

Set the random seed for reproducibility¶

In [3]:
uq.rng(10,'twister');

COMPUTATIONAL MODEL¶

The two-dimensional hat function is defined as follows:

$$g(x_1, x_2) = 20 - (x_1 - x_2)^2 - 8 (x_1 + x_2 - 4)^3$$

Create a limit state function model based on the hat function using a string, written below in a vectorized operation:

In [4]:
ModelOpts = { 
    'Type': 'Model', 
    'mString': '20 - (X(:,1)-X(:,2)).^2 - 8*(X(:,1)+X(:,2)-4).^3',
    'isVectorized': 1
}

myModel = uq.createModel(ModelOpts)

PROBABILISTIC INPUT MODEL¶

The probabilistic input model consists of two independent and identically-distributed Gaussian random variables:

$$X_i \sim \mathcal{N}(0.25, 1), \quad i = 1, 2$$

Specify the marginals of the two input random variables:

In [5]:
InputOpts = {
    "Marginals": [
        {"Name": "X1",               
         "Type": "Gaussian",
         "Parameters": [0.25, 1]
        },
        {"Name": "X2",
         "Type": "Gaussian",
         "Parameters": [0.25, 1]
        }
    ]
}

Create the INPUT object based on the specified marginals:

In [6]:
myInput = uq.createInput(InputOpts)

STRUCTURAL RELIABILITY¶

Failure event is defined as $g(\mathbf{x}) \leq 0$. The failure probability is then defined as $P_f = P[g(\mathbf{x})\leq 0]$.

Three reliability analyses are performed and in each instance, a specific aspect of the framework is finely tuned.

Select the Reliability module and the active learning method:

In [7]:
ALROptions = {
    "Type": "Reliability",
    "Method": "ALR"
}

Enrichment and convergence options¶

Specify the number of enrichment points per iteration

In [8]:
ALROptions["ALR"] = {"NumOfPoints": 2}

Specify options related to convergence

Here we combine two stopping criteria, i.e., the algorithm will stop only when the two conditions are satisfied

In [9]:
ALROptions["ALR"]["Convergence"] = ["StopBetaBound", "StopBetaStab"]

Specify the convergence threshold for each of the stopping criteria

In [10]:
ALROptions["ALR"]["ConvThres"] =  [[0.01, 0.05]]

Specify the maximum number of enrichment points

In [11]:
ALROptions["ALR"]["MaxAddedED"] = 20

Run the active learning reliability analysis

In [12]:
myALRAnalysis = uq.createAnalysis(ALROptions)
Processing .
.
.
. done!

Print out a report of the results

In [13]:
uq.print(myALRAnalysis)
---------------------------------------------------
Active learning reliability
---------------------------------------------------
Pf               4.3967e-04       
Beta             3.3265           
CoV              0.0229           
ModelEvaluations 16               
PfCI             [4.1990e-04 4.5945e-04]
BetaCI           [3.3142e+00 3.3393e+00]
PfMinus/Plus     [4.3967e-04 4.3967e-04]
---------------------------------------------------


Visualize the results of the analysis

In [14]:
uq.display(myALRAnalysis);

Metamodel options¶

Select Kriging as surrogate model

In [15]:
ALROptions["ALR"]["Metamodel"] = "Kriging" 

Any option from the Kriging module can be specified here, for instance:

  • Correlation function options
In [16]:
KRGOptions = {
    "Corr": {
        "Family": "Gaussian",
        "Nugget": 1e-10
    }
}
  • Optimization options
In [17]:
KRGOptions["EstimMethod"] = "ML" 
KRGOptions["Optim"] = {"Method": "HGA"}

After defining the options, assign them to the ALR algorithm

In [18]:
ALROptions["ALR"]["Kriging"] = KRGOptions 

Run the active learning reliability analysis

In [19]:
myALRAnalysis = uq.createAnalysis(ALROptions)
Processing .
.
.
.
 done!

Print out a report of the results

In [20]:
uq.print(myALRAnalysis)
---------------------------------------------------
Active learning reliability
---------------------------------------------------
Pf               4.5164e-04       
Beta             3.3190           
CoV              0.0229           
ModelEvaluations 24               
PfCI             [4.3139e-04 4.7188e-04]
BetaCI           [3.3068e+00 3.3318e+00]
PfMinus/Plus     [4.2812e-04 4.7912e-04]
---------------------------------------------------


Visualize the results of the analysis

In [21]:
uq.display(myALRAnalysis);

Modify the reliability algorithm and its options¶

The default reliability algorithm is subset simulation. Below, we will specify its options for the analysis

Specify the sample size in each subset

In [22]:
ALROptions["Simulation"] = {"BatchSize": 1e4}

Specify the maximum sample size

In [23]:
ALROptions["Simulation"]["MaxSampleSize"] = 1e6

Specify the target conditional failure probability in each subset ($p_0$)

In [24]:
ALROptions["Subset"] = {"p0": 0.2} 

Run the active learning reliability analysis

In [25]:
myALRAnalysis = uq.createAnalysis(ALROptions)
Processing .
.
.
.
 done!

Print out a report of the results

In [26]:
uq.print(myALRAnalysis)
---------------------------------------------------
Active learning reliability
---------------------------------------------------
Pf               3.4048e-04       
Beta             3.3971           
CoV              0.0708           
ModelEvaluations 30               
PfCI             [2.9322e-04 3.8774e-04]
BetaCI           [3.3614e+00 3.4378e+00]
PfMinus/Plus     [3.1728e-04 3.6688e-04]
---------------------------------------------------


Visualize the results of the analysis

Notice how the coefficient of variation of the estimated failure probability has decreased (compred to the two previous cases) thanks to the specification of a more robust setting for subset simulation.

In [27]:
uq.display(myALRAnalysis);

Terminate the remote UQCloud session¶

In [28]:
mySession.quit()
 uqpylab.sessions :: INFO     :: Session 7ee2d780742446bc92e8588cc4b6e61a terminated.
Out[28]:
True