SENSITIVITY ANALYSIS: DEPENDENT INPUT VARIABLES¶

In this example, the Kucherenko and ANCOVA sensitivity indices are computed and compared for the <https://www.sfu.ca/~ssurjano/shortcol short column function> with correlated input parameters.

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

Set the random seed for reproducibility¶

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

2 - COMPUTATIONAL MODEL¶

The short-column function is an analytical 3-dimensional function that models the limit state of a short steel column with a rectangular cross-section, subjected to a bending moment and an axial force. The short column function |uq_shortcol| is supplied with UQpyLab.

Create a MODEL object from the function file:

In [4]:
ModelOpts = {
    'Type': 'Model',
    'ModelFun': 'shortcol.model',
}

myModel = uq.createModel(ModelOpts)

3 - PROBABILISTIC INPUT MODEL¶

The probabilistic input model consists of three random variables with the following marginals:

Variable Description Distribution Mean Std. deviation
Y Yield stress Lognormal 5 MPa 0.5 MPa
M Bending moment Gaussian 2000 N.mm 400 N.mm
P Axial force Gaussian 500 N 100 N

Define the marginal distributions of the input model:

In [5]:
InputOpts = {
    'Marginals': [
        {
        'Name': 'Y', # yield stress
        'Type': 'Lognormal',
        'Moments': [5, 0.5] # (MPa)
        },
        {
        'Name': 'M', # bending moment
        'Type': 'Gaussian',
        'Moments': [2000, 400] # (N.mm)
        },
        {
        'Name': 'P', # axial force
        'Type': 'Gaussian',
        'Moments': [500, 100] # (N)
        }]
}

The parameters $P$ and $M$ are assumed to be correlated under Gaussian copula with a rank correlation of 0.72.

Define the Gaussian copula and its parameters:

In [6]:
InputOpts['Copula'] = {
    'Type': 'Gaussian',
    'RankCorr': [[1, 0, 0], [0, 1, 0.72], [0, 0.72, 1]]
}

Create an INPUT object based on the specified marginals and copula:

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

Show the correlated input:

In [8]:
uq.display(myInput);

4 - SENSITIVITY ANALYSIS¶

In the following, the Kucherenko indices are compared to the ANCOVA indices.

4.1 Kucherenko indices¶

First, select the sensitivity tool in UQpyLab and the Kucherenko analysis method:

In [9]:
KucherenkoOpts = {
    'Type': 'Sensitivity',
    'Method': 'Kucherenko'
}

Specify the sample size for the analysis:

In [10]:
KucherenkoOpts['Kucherenko'] = {'SampleSize': 5e4}

Note that the resulting cost depends on the estimator. The default estimator is the Modified estimator with a total computational cost of $(2M+2) \times N$, where $M$ is the input dimension and $N$ is the sample size.

Therefore, the total cost for the current setup is $(2 \cdot 3 + 2) \times 5 \cdot 10^4 = 4 \times 10^5$ evaluations of the full computational model.

Run the Kucherenko analysis:

In [11]:
myKucherenkoAnalysis = uq.createAnalysis(KucherenkoOpts)
Processing .
 done!

 uqpylab.sessions :: INFO     :: Received intermediate compute request, function: shortcol.model.
 uqpylab.sessions :: INFO     :: Carrying out local computation...
 uqpylab.sessions :: INFO     :: Local computation complete.
 uqpylab.sessions :: INFO     :: Starting transmission of intermediate compute results ((100000,))...
 uqpylab.sessions :: INFO     :: Intermediate compute results sent.
 uqpylab.sessions :: INFO     :: Received intermediate compute request, function: shortcol.model.
 uqpylab.sessions :: INFO     :: Carrying out local computation...
 uqpylab.sessions :: INFO     :: Local computation complete.
 uqpylab.sessions :: INFO     :: Starting transmission of intermediate compute results ((100000,))...
 uqpylab.sessions :: INFO     :: Intermediate compute results sent.
 uqpylab.sessions :: INFO     :: Received intermediate compute request, function: shortcol.model.
 uqpylab.sessions :: INFO     :: Carrying out local computation...
 uqpylab.sessions :: INFO     :: Local computation complete.
 uqpylab.sessions :: INFO     :: Starting transmission of intermediate compute results ((100000,))...
 uqpylab.sessions :: INFO     :: Intermediate compute results sent.
 uqpylab.sessions :: INFO     :: Received intermediate compute request, function: shortcol.model.
 uqpylab.sessions :: INFO     :: Carrying out local computation...
 uqpylab.sessions :: INFO     :: Local computation complete.
 uqpylab.sessions :: INFO     :: Starting transmission of intermediate compute results ((100000,))...
 uqpylab.sessions :: INFO     :: Intermediate compute results sent.

4.2 ANCOVA indices¶

Select the sensitivity tool in UQLab and the ANCOVA analysis method:

In [12]:
ANCOVAOpts = {
    'Type': 'Sensitivity',
    'Method': 'ANCOVA'
}

Specify the sample size for the analysis (the sample will be used to construct a PCE model):

In [13]:
ANCOVAOpts['ANCOVA'] = {'SampleSize': 150}

Run the ANCOVA sensitivity analysis:

In [14]:
myANCOVAAnalysis = uq.createAnalysis(ANCOVAOpts)
 uqpylab.sessions :: INFO     :: Received intermediate compute request, function: shortcol.model.
 uqpylab.sessions :: INFO     :: Carrying out local computation...
 uqpylab.sessions :: INFO     :: Local computation complete.
 uqpylab.sessions :: INFO     :: Starting transmission of intermediate compute results ((150,))...
 uqpylab.sessions :: INFO     :: Intermediate compute results sent.

5 - RESULTS¶

Print out a report on the Kucherenko analysis:

In [15]:
uq.print(myKucherenkoAnalysis)
--------------------------------------------------
  Total Kucherenko indices for output component 1
--------------------------------------------------
Y           M           P           
0.248495    0.030790    0.211492    
--------------------------------------------------
--------------------------------------------------
  First Order Kucherenko indices for output component 1
--------------------------------------------------
Y           M           P           
0.221721    0.551340    0.720783    
--------------------------------------------------
Total cost (model evaluations): 400000


Display a graphical representation of the analysis:

In [16]:
uq.display(myKucherenkoAnalysis);

Print out a report on the ANCOVA analysis:

In [17]:
uq.print(myANCOVAAnalysis)
--------------------------------------------------
     ANCOVA indices for output component 1
--------------------------------------------------
Indices     Y           M           P           
S           0.220       0.190       0.564       
S^U         0.220       0.065       0.439       
S^I         0.001       0.000       0.001       
S^C         -0.001      0.124       0.124       
--------------------------------------------------
Total cost (model evaluations): 150


Display a graphical representation of the analysis:

In [18]:
uq.display(myANCOVAAnalysis);

Terminate the remote UQCloud session¶

In [19]:
mySession.quit()
 uqpylab.sessions :: INFO     :: Session 1f52785b95f645d0a8e9246e4ee21980 terminated.
Out[19]:
True