Skip to main content

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

Build Status: Build Status Test Coverage: Coverage Status

Included methods

Contributing: see here

Quick Start

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, 1024)

# 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 section in the documentation.

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(1024, 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 shown previously.

Also check out the FAQ and examples for a full description of options for each method.

How to cite SALib

If you would like to use our software, please cite it using the following:

Herman, J. and Usher, W. (2017) SALib: An open-source Python library for sensitivity analysis. Journal of Open Source Software, 2(9). doi:10.21105/joss.00097

paper status

If you use BibTeX, cite using the following entry:

@article{Herman2017,
  doi = {10.21105/joss.00097},
  url = {https://doi.org/10.21105/joss.00097},
  year  = {2017},
  month = {jan},
  publisher = {The Open Journal},
  volume = {2},
  number = {9},
  author = {Jon Herman and Will Usher},
  title = {{SALib}: An open-source Python library for Sensitivity Analysis},
  journal = {The Journal of Open Source Software}
}

Projects that use SALib

Many projects now use the Global Sensitivity Analysis features provided by SALib. Here is a selection:

Software

Blogs

Videos

If you would like to be added to this list, please submit a pull request, or create an issue.

Many thanks for using SALib.

How to contribute

See here for how to contribute to SALib.

License

Copyright (C) 2012-2019 Jon Herman, Will Usher, and others. Versions v0.5 and later are released under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SALib-1.4.6b0.tar.gz (903.0 kB view details)

Uploaded Source

Built Distribution

SALib-1.4.6b0-py2.py3-none-any.whl (751.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file SALib-1.4.6b0.tar.gz.

File metadata

  • Download URL: SALib-1.4.6b0.tar.gz
  • Upload date:
  • Size: 903.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for SALib-1.4.6b0.tar.gz
Algorithm Hash digest
SHA256 9f184c340be0867f01cefccc5624ee21277d4a2f473439552e4f4cc6f596d144
MD5 68c2f49d8870625c44495c30b0d4639c
BLAKE2b-256 e7b8e802b999214ce3223f2f37237d5c51a621a7a28f646352f5f486ce96e562

See more details on using hashes here.

File details

Details for the file SALib-1.4.6b0-py2.py3-none-any.whl.

File metadata

  • Download URL: SALib-1.4.6b0-py2.py3-none-any.whl
  • Upload date:
  • Size: 751.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for SALib-1.4.6b0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c7c293efdcc71f0ca38d651a1e74821026122ead2593d68d2dd30538f79a866
MD5 29e9f7657864f39224480e56e5a9b12b
BLAKE2b-256 82a2fac934716931f0d59a16cfa0b239f116aaf1ebea22001e3aeb49d2cc6138

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page