RELIABILITY: ACTIVE LEARNING ON THE HAT FUNCTION¶

This example showcases the application of active learning reliability in UQ[py]Lab, using the hat function and the default settings of the module.

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 (25abacf4b0044c50a59a17c894f07023) started.
 uqpylab.sessions :: INFO     :: Reset successful.

Set the random seed for reproducibility¶

In [3]:
uq.rng(100,'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]$.

The reliability analysis is performed with an active learning scheme created by combining the default methods in each component of the framework:

  • Surrogate model: PC-Kriging
  • Reliability algorithm: Subset simulation
  • Learning function: Deviation number (U)
  • Convergence criterion: Stop Beta Bounds

Select the Reliability module and the active learning method:

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

Run the active learning reliability analysis:

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

Print out a report of the results:

In [9]:
uq.print(myALRAnalysis)
---------------------------------------------------
Active learning reliability
---------------------------------------------------
Pf               4.4652e-04       
Beta             3.3222           
CoV              0.0229           
ModelEvaluations 12               
PfCI             [4.2650e-04 4.6653e-04]
BetaCI           [3.3100e+00 3.3350e+00]
PfMinus/Plus     [4.4652e-04 4.4652e-04]
---------------------------------------------------


Visualize the results of the analysis:

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

Terminate the remote UQCloud session¶

In [11]:
mySession.quit()
 uqpylab.sessions :: INFO     :: Session 25abacf4b0044c50a59a17c894f07023 terminated.
Out[11]:
True