敏感性分析工具。包含 Sobol、Morris 和 FAST 方法
项目描述
常用敏感性分析方法的 Python 实现。在系统建模中用于计算模型输入或外生因素对感兴趣输出的影响。
文档: ReadTheDocs
要求: NumPy、 SciPy、 matplotlib、 pandas、 Python 3(从 SALib v1.2 起 SALib 不正式支持 Python 2)
安装: pip install SALib或python setup.py install或conda install SALib
包含的方法
Sobol 敏感性分析 ( Sobol 2001 , Saltelli 2002 , Saltelli et al. 2010 )
莫里斯方法,包括组和最佳轨迹(Morris 1991 , Campolongo et al. 2007 , Ruano et al. 2012)
扩展傅立叶幅度灵敏度测试 (eFAST) ( Cukier et al. 1973 , Saltelli et al. 1999 , Pujol (2006) in Iooss et al., (2021) )
随机平衡设计 - 傅立叶幅度灵敏度测试 (RBD-FAST) ( Tarantola et al. 2006 , Plischke 2010 , Tissot et al. 2012 )
Delta Moment-Independent Measure ( Borgonovo 2007 , Plischke et al. 2013 )
基于导数的全球敏感度测量 (DGSM) ( Sobol and Kucherenko 2009 )
部分因子敏感性分析 ( Saltelli et al. 2008 )
高维模型表示 (HDMR) ( Rabitz et al. 1999 , Li et al. 2010 )
PAWN (钢琴和瓦格纳 2018 年,钢琴和瓦格纳 2015 年)
贡献:看这里
快速开始
程序方法
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)
也可以在具有 3 列的文件中指定参数范围:
# name lower_bound upper_bound P1 0.0 1.0 P2 0.0 5.0 ...etc.
然后可以从 read_param_file函数创建上面的问题字典:
from SALib.util import read_param_file
problem = read_param_file('/path/to/file.txt')
# ... same as above
参数文件以及命令行界面包括许多其他选项。请参阅文档中的高级部分。
方法链方法
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()
以上等价于前面显示的程序方法。
如何引用 SALib
如果您想使用我们的软件,请使用以下方式引用它:
Herman, J. 和 Usher, W. (2017) SALib:用于敏感性分析的开源 Python 库。开源软件杂志,2(9)。doi:10.21105/joss.00097
如果您使用 BibTeX,请使用以下条目引用:
@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} }
使用 SALib 的项目
许多项目现在使用 SALib 提供的全局敏感性分析功能。这是一个选择:
软件
博客
视频
如果您想被添加到此列表中,请提交拉取请求或创建问题。
非常感谢您使用 SALib。
如何贡献
请参阅此处了解如何为 SALib 做出贡献。
执照
版权所有 (C) 2012-2019 Jon Herman、Will Usher 等。v0.5 和更高版本是在MIT 许可下发布的。