Skip to main content
https://raw.githubusercontent.com/SALib/SALib/main/docs/assets/logo.png

Sensitivity Analysis Library (SALib)

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 pip 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:

Iwanaga, T., Usher, W., & Herman, J. (2022). Toward SALib 2.0: Advancing the accessibility and interpretability of global sensitivity analyses. Socio-Environmental Systems Modelling, 4, 18155. doi:10.18174/sesmo.18155

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 entries:

@article{Iwanaga2022,
  title = {Toward {SALib} 2.0: {Advancing} the accessibility and interpretability of global sensitivity analyses},
  volume = {4},
  url = {https://sesmo.org/article/view/18155},
  doi = {10.18174/sesmo.18155},
  journal = {Socio-Environmental Systems Modelling},
  author = {Iwanaga, Takuya and Usher, William and Herman, Jonathan},
  month = may,
  year = {2022},
  pages = {18155},
}

@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.

Release files for SALib 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SALib 1.6.0
File Size Uploaded
salib-1.6.0.tar.gz 738.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SALib 1.6.0
File Interpreter ABI Platform
salib-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / salib-1.6.0.tar.gz

Download URL salib-1.6.0.tar.gz
Size 738.4 kB
Tags Source
SHA-256 checksum
How to use checksums
122d25816137a50b5e972a206de7118961e202a6fb0922d9ec874fd49fdbbf5f
BLAKE2b-256 checksum
How to use checksums
3f9d5740846179a70e3771d4465d369bd64de81d773e124440c062728309f8b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.21"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.21","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.0

Release files / salib-1.6.0-py3-none-any.whl

Download URL salib-1.6.0-py3-none-any.whl
Size 800.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bb4f03651543fd883c849e73595bca1e8b5e5e0b6562f6902262ef9bde615df
BLAKE2b-256 checksum
How to use checksums
10d91d2e123d88c388956c3ffd09de804043f3ec77a84e425e6b620d0c3f080b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.21"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.21","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.0

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.1

2 release files

1.4.0.1

1 release file

1.4.0

1 release file

1.3.13

1 release file

1.3.12

1 release file

1.3.11

1 release file

1.3.8

1 release file

1.3.7

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.2

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

0.7.1

1 release file

0.7

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page