{"id":6233,"library":"salib","title":"SALib: Sensitivity Analysis Library","description":"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.","status":"active","version":"1.5.2","language":"en","source_language":"en","source_url":"https://github.com/SALib/SALib","tags":["sensitivity analysis","monte carlo","modeling","simulation","uncertainty analysis","global sensitivity analysis"],"install":[{"cmd":"pip install SALib","lang":"bash","label":"PyPI (recommended)"},{"cmd":"conda install conda-forge::salib","lang":"bash","label":"Conda"}],"dependencies":[{"reason":"Core numerical operations; requires >=2.0 since SALib 1.5.2.","package":"numpy","optional":false},{"reason":"Mathematical and scientific computations.","package":"scipy","optional":false},{"reason":"Plotting and visualization of results.","package":"matplotlib","optional":false},{"reason":"Data structures and analysis, especially for results handling.","package":"pandas","optional":false}],"imports":[{"note":"Sampling methods are imported from the `SALib.sample` submodule.","symbol":"sample_method","correct":"from SALib.sample import saltelli"},{"note":"Analysis methods are imported from the `SALib.analyze` submodule.","symbol":"analyze_method","correct":"from SALib.analyze import sobol"},{"note":"For the object-oriented interface, ProblemSpec is imported directly from the top-level `SALib` package.","symbol":"ProblemSpec","correct":"from SALib import ProblemSpec"}],"quickstart":{"code":"import numpy as np\nfrom SALib.sample import saltelli\nfrom SALib.analyze import sobol\nfrom SALib.test_functions import Ishigami\n\n# 1. Define the model inputs\nproblem = {\n    'num_vars': 3,\n    'names': ['x1', 'x2', 'x3'],\n    'bounds': [[-np.pi, np.pi]] * 3\n}\n\n# 2. Generate samples\nparam_values = saltelli.sample(problem, 1024)\n\n# 3. Run model (example: Ishigami function)\nY = Ishigami.evaluate(param_values)\n\n# 4. Perform analysis\nSi = sobol.analyze(problem, Y, print_to_console=True)\n\nprint(f\"First-order sensitivity indices: {Si['S1']}\")\nprint(f\"Total-order sensitivity indices: {Si['ST']}\")","lang":"python","description":"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."},"warnings":[{"fix":"Ensure your Python environment is running Python 3.x (>=3.9 recommended for 1.5.2).","message":"SALib version 1.2 and onwards officially dropped support for Python 2. Users must use Python 3 or later versions.","severity":"breaking","affected_versions":">=1.2"},{"fix":"Update your code to pass NumPy arrays (e.g., `param_values`, `Y`) directly to sampling and analysis functions like `saltelli.sample()` and `sobol.analyze()`.","message":"Starting with SALib 1.0.0, the Python API for sampling and analysis methods expects NumPy matrices directly as input for model runs and results, rather than file paths. The command-line interface remains unchanged.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade NumPy in your environment to version 2.0 or newer using `pip install --upgrade numpy`.","message":"SALib 1.5.2 introduced an updated NumPy dependency, requiring NumPy version 2.0 or higher.","severity":"breaking","affected_versions":">=1.5.2"},{"fix":"Always use the appropriate sampling method for the chosen analysis method, as specified in the SALib documentation. E.g., `SALib.sample.saltelli` for `SALib.analyze.sobol`.","message":"Mismatching sampling and analysis methods can lead to incorrect sensitivity indices. For example, Sobol' analysis requires samples generated by a Sobol' sampler (like Saltelli's).","severity":"gotcha","affected_versions":"All"},{"fix":"Be aware of the output normalization behavior if comparing results with other tools, and consider increasing sample size for non-centered outputs if normalization is bypassed or if convergence issues are observed.","message":"Sobol' index estimates can be biased if model outputs are not centered. SALib normalizes outputs by default to mitigate this. If using non-normalized outputs, larger sample sizes may be required for convergence.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}