Python中的开源流行病学建模
pyepidemics的Python项目详细描述
流行病
开源流行病建模Python库
pyepeditions是一个Python库,可以轻松地操作流行病学模型(SIR、SEIR、COVID19)、预测和测试策略场景。主要特点有:
- 创建经典房室模型(SIR、SEIR、SEIDR等)
- COVID19相关模型的建立(有ICU和不同程度的症状)
- 定制房室模型的创建
- 易于扩展到不同层次的房室模型(按年龄、按地区、按年龄和地区等)
- 接触矩阵的实现
- 执行策略(锁定、跟踪、测试等)
- 基于贝叶斯优化的实际数据流行病学参数校正
- 数据帮助器获取最新数据(病例、床位可用性、人群接触矩阵)(截至目前,NB仅适用于法国案例)
- 简单曲线拟合算法
- 消费与生产的经济学模型
This library is under active development, please contact Théo Alves Da Costa if you need more information and would like to contribute
贡献者
该图书馆最初是由法国人工智能公司CoData联合开发的,目的是帮助法国政府应对COVID19流行病。主要贡献者有:
- Théo Alves Da Costa,电子计量学
- 埃米莉·拉诺,艾米米计量学
- Léo Grossjean,Ekimetrics公司
- Pierre Carles,Ekimetrics公司
- Nicolas Chesneau,Ekimetrics公司
- Marianne Chehade,Ekimetrics公司
- 让-巴普蒂斯特·雷米
安装
使用pip安装
我们建议首先创建一个虚拟环境,然后可以使用命令安装库
pip install pyepidemics
回购在PyPI上的https://pypi.org/project/pyepidemics/
从源安装
您还可以通过在本地克隆存储库并在本地使用它来安装存储库,或者通过首先调用来安装控制盘
^{pr2}$文件
文档可从https://collectif-codata.github.io/pyepidemics获取
文件夹结构
- pyepidemics/ --------- Python library centralizing source code
- dataset/ --------- Helpers to get up-to-date COVID19 datasets
- models/ --------- Compartmental models code
- params/ --------- Epidemiological parameters calibration optimizers
- policies/ --------- Scenarios implementation
- visualization/ --------- Visualization helpers (chloropleth maps using pydeck)
- data/ --------- Local datasets if needed
- docs/ --------- Documentation and tutorial notebooks
- notebook/ --------- Development notebooks
- references/ --------- Reports and research papers
- scripts/ --------- Automation scripts on calibration
- requirements.txt --------- Python requirements
快速启动
创建SIR模型
# Import libraryfrompyepidemics.modelsimportSIR# Let's take approximate parameters during COVID19 epidemicsN=67e6beta=3.3/4gamma=1/4# Instantiate model with epidemiological parameterssir=SIR(N,beta,gamma)# Solve for one infected case for 100 days starting from 2020-01-24states=sir.solve(1,n_days=100,start_date="2020-01-24")# Visualize epidemic curves using matplotlib (plotly available)states.show(plotly=False)
创建自定义分隔模型
下面是创建与上述SIR类似的模型的示例
frompyepidemics.modelsimportCompartmentalModelclassSIR(CompartmentalModel):def__init__(self,N,beta,gamma):# Define compartments name and numbercompartments=["S","I","R"]super().__init__(compartments)# Parametersself.N=N# Total populationself.beta=beta# How many person each person infects per dayself.gamma=gamma# Rate of infection, duration = 1/gamma# Add transitionself.add_transition("S","I",lambday,t:self.beta*y["S"]*y["I"]/self.N)self.add_transition("I","R",lambday,t:self.gamma*y["I"])
捐款指南
WIP
参考文献
许可证
麻省理工学院执照
- 项目
标签: