SALib: Sensitivity Analysis Library

1.5.2 · active · verified Tue Apr 14

SALib is an open-source Python library providing implementations of various global sensitivity analysis methods, including Sobol', Morris, FAST, DGSM, PAWN, HDMR, Moment Independent, and fractional factorial. It is currently at version 1.5.2 and maintains an active development status with somewhat regular releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a Sobol' sensitivity analysis using the Ishigami test function. It covers defining problem parameters, generating samples using the Saltelli sampler, evaluating a model, and analyzing the results to compute sensitivity indices.

import numpy as np
from SALib.sample import saltelli
from SALib.analyze import sobol
from SALib.test_functions import Ishigami

# 1. Define the model inputs
problem = {
    'num_vars': 3,
    'names': ['x1', 'x2', 'x3'],
    'bounds': [[-np.pi, np.pi]] * 3
}

# 2. Generate samples
param_values = saltelli.sample(problem, 1024)

# 3. Run model (example: Ishigami function)
Y = Ishigami.evaluate(param_values)

# 4. Perform analysis
Si = sobol.analyze(problem, Y, print_to_console=True)

print(f"First-order sensitivity indices: {Si['S1']}")
print(f"Total-order sensitivity indices: {Si['ST']}")

view raw JSON →