Sobol’ Sensitivity Analysis
This module is used to compute Sobol’ indices given model (e.g. simulator or emulator)
outputs evaluated at chosen Saltelli samples (see the Saltelli
class).
Detailed description of the theory can be found in Saltelli [2002] and Saltelli et al. [2010].
The SobolAnalyze
class relies on the Python package SALib [Herman and Usher, 2017].
SobolAnalyze Class
The SobolAnalyze
class is imported by:
from psimpy.sensitivity.sobol import SobolAnalyze
Methods
- class SobolAnalyze(ndim, Y, calc_second_order=True, nresamples=100, conf_level=0.95, seed=None)[source]
Sobol’ sensitivity analysis. This class is built based on
SALib.analyze.sobol()
.- Parameters
ndim (int) – Dimension of parameter
x
.Y (numpy array) – Model outputs evaluated at varaible input points drawn by Saltelli sampling. Shape of
(nsaltelli, nrealizations)
.nsaltelli
is the number of Saltelli sample points, andnrealizations
is the number of realizations of model output at one input point. More specially: \(nrealizations=1\) for a deterministic model which returns a scalar output at one input point, and \(nrealizations>1\) for a stochastic model which returns multiple realizations of a scalar output at one input point (such as a Gaussian process model). If \(nrealizations=1\), an array of shape(nsaltelli,)
is also valid.calc_second_order (bool, optional) – If True, calculate secord order Sobol’ indices.
nresamples (int, optional) – Size of bootstrap sampling.
conf_level (float, optional) – Confidence interval level. Must be a value within the range \((0,1)\).
seed (int, optional) – Seed to initialize the pseudo-random number generator.
- run(mode=None, max_workers=None)[source]
Perform Sobol’ analysis.
- Parameters
mode (str, optional) – ‘parallel’ or ‘serial’. Run sobol’ analysis for each colomn of
Y
in parallel or in serial. Only relevant when \(nrealizations>1\).max_workers (int, optional) – The maximum number of tasks running in parallel. Default is the number of CPUs on the host. Only relevant when \(nrealizations>1\).
- Returns
S_res – Sobol’ sensitivity indices. S_res[‘S1’] -
numpy.ndarray
of shape(ndim, 3)
, first-order Sobol’ index, its std, and conf_level for each parameter. S_res[‘ST’] -numpy.ndarray
of shape(ndim, 3)
, total-effect Sobol’ index, its std, and conf_level for each parameter. S_res[‘S2’] -numpy.ndarray
of shape(ndim*(ndim-1)/2, 3)
, second-order Sobol’ index, its std, and conf_level for each pair of parameters. S_res[‘S2’] is only available ifcalc_second_order
is True.- Return type
dict