Tools for sensitivity analysis. Contains Sobol, Morris, and FAST methods
Project description
Python implementations of commonly used sensitivity analysis methods. Useful in systems modeling to calculate the effects of model inputs or exogenous factors on outputs of interest.
Documentation: ReadTheDocs
Requirements: NumPy, SciPy, matplotlib, pandas, Python 3 (from SALib v1.2 onwards SALib does not officially support Python 2)
Installation: pip install SALib or python setup.py install or conda install SALib
Herman, J., Usher, W., (2017), SALib: An open-source Python library for Sensitivity Analysis, Journal of Open Source Software, 2(9), 97, doi:10.21105/joss.00097
Methods included:
Sobol Sensitivity Analysis (Sobol 2001, Saltelli 2002, Saltelli et al. 2010)
Method of Morris, including groups and optimal trajectories (Morris 1991, Campolongo et al. 2007, Ruano et al. 2012)
extended Fourier Amplitude Sensitivity Test (FAST) (Cukier et al. 1973, Saltelli et al. 1999)
Random Balance Designs - Fourier Amplitude Sensitivity Test (RBD-FAST) (Tarantola et al. 2006, Plischke 2010, Tissot et al. 2012)
Delta Moment-Independent Measure (Borgonovo 2007, Plischke et al. 2013)
Derivative-based Global Sensitivity Measure (DGSM) (Sobol and Kucherenko 2009)
Fractional Factorial Sensitivity Analysis (Saltelli et al. 2008)
High-Dimensional Model Representation (HDMR) (Li et al. 2010)
Contributing: see here
Quick Start
Method chaining approach
Chaining calls is supported from SALib v1.4
from SALib import ProblemSpec
from SALib.test_functions import Ishigami
import numpy as np
# By convention, we assign to "sp" (for "SALib Problem")
sp = ProblemSpec({
'names': ['x1', 'x2', 'x3'], # Name of each parameter
'bounds': [[-np.pi, np.pi]]*3, # bounds of each parameter
'outputs': ['Y'] # name of outputs in expected order
})
(sp.sample_saltelli(1000, calc_second_order=True)
.evaluate(Ishigami.evaluate)
.analyze_sobol(print_to_console=True))
print(sp)
# Samples, model results and analyses can be extracted:
print(sp.samples)
print(sp.results)
print(sp.analysis)
# Basic plotting functionality is also provided
sp.plot()
The above is equivalent to the procedural approach below:
Procedural approach
from SALib.sample import saltelli
from SALib.analyze import sobol
from SALib.test_functions import Ishigami
import numpy as np
problem = {
'num_vars': 3,
'names': ['x1', 'x2', 'x3'],
'bounds': [[-np.pi, np.pi]]*3
}
# Generate samples
param_values = saltelli.sample(problem, 1000)
# Run model (example)
Y = Ishigami.evaluate(param_values)
# Perform analysis
Si = sobol.analyze(problem, Y, print_to_console=True)
# Returns a dictionary with keys 'S1', 'S1_conf', 'ST', and 'ST_conf'
# (first and total-order indices with bootstrap confidence intervals)
It’s also possible to specify the parameter bounds in a file with 3 columns:
# name lower_bound upper_bound P1 0.0 1.0 P2 0.0 5.0 ...etc.
Then the problem dictionary above can be created from the read_param_file function:
from SALib.util import read_param_file
problem = read_param_file('/path/to/file.txt')
# ... same as above
Lots of other options are included for parameter files, as well as a command-line interface. See the advanced readme.
Also check out the examples for a full description of options for each method.
License
Copyright (C) 2012-2019 Jon Herman, Will Usher, and others. Versions v0.5 and later are released under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file SALib-1.4.0rc0.tar.gz
.
File metadata
- Download URL: SALib-1.4.0rc0.tar.gz
- Upload date:
- Size: 887.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0603e3e636396ade0e67e0f1ea3912c6cb177a1c48c306e158e90ade057a7291 |
|
MD5 | e73d555a051c5eba2127f6db9eb50866 |
|
BLAKE2b-256 | e172dc1eb233f91c7916093f6b21378fabd0a4c58ea87eedaf2a92a913f4aa60 |