A Pytorch library for machine learning in epidemic modeling
Project description
Epidemic Modeling with Pytorch
EpiLearn is a Pytorch-based machine learning tool-kit for epidemic data modeling and analysis. We provide numerour features including:
- Implementation of Epidemic Models
- Simulation of Epidemic Spreading
- Visualization of Epidemic Data
- Unified Pipeline for Epidemic Tasks
Installation
From Source
git clone https://github.com/Emory-Melody/EpiLearn.git
cd EpiLearn
conda create -n epilearn python=3.9
conda activate epilearn
python setup.py install
pip install pytorch_geometric
From Pypi
pip install epilearn
Tutorial
We provide a complete tutorial of EpiLearn in our documentation and the overal framework in our paper. For more examples, please refer to the examples folder.
Here we also offer a quickstart of how to use the EpiLearn for forecast and detection task.
Forecast Pipeline
from epilearn.models.SpatialTemporal.STGCN import STGCN
from epilearn.data import UniversalDataset
from epilearn.utils import transforms
from epilearn.tasks.forecast import Forecast
# initialize settings
lookback = 12 # inputs size
horizon = 3 # predicts size
# load toy dataset
dataset = UniversalDataset()
dataset.load_toy_dataset()
# Adding Transformations
transformation = transforms.Compose({
"features": [transforms.normalize_feat()],
"graph": [transforms.normalize_adj()]})
dataset.transforms = transformation
# Initialize Task
task = Forecast(prototype=STGCN,
dataset=None,
lookback=lookback,
horizon=horizon,
device='cpu')
# Training
result = task.train_model(dataset=dataset,
loss='mse',
epochs=50,
batch_size=5,
permute_dataset=True)
# Evaluation
evaluation = task.evaluate_model()
Detection Pipeline
from epilearn.models.Spatial.GCN import GCN
from epilearn.data import UniversalDataset
from epilearn.utils import transforms
from epilearn.tasks.detection import Detection
# initialize settings
lookback = 1 # inputs size
horizon = 2 # predicts size; also seen as number of classes
# load toy dataset
dataset = UniversalDataset()
dataset.load_toy_dataset()
# Adding Transformations
transformation = transforms.Compose({
" features": [],
" graph": []})
dataset.transforms = transformation
# Initialize Task
task = Detection(prototype=GCN,
dataset=None,
lookback=lookback,
horizon=horizon,
device='cpu')
# Training
result = task.train_model(dataset=dataset,
loss='ce',
epochs=50,
batch_size=5)
# Evaluation
evaluation = task.evaluate_model()
Web Interface
Our web application can be initiated using:
python -m streamlit run interface/app.py to activate the interface
Citing
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file epilearn-0.0.1.tar.gz.
File metadata
- Download URL: epilearn-0.0.1.tar.gz
- Upload date:
- Size: 81.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86e818cf0c16ce0345fe6150ee636c98013f97397c15021c9981888df32f58da
|
|
| MD5 |
afa84e0db966e3b49a443974f74218d7
|
|
| BLAKE2b-256 |
2c65bf40599a6825e935f342296c99de75c2fff0302a40d0cce150e6ecda29ef
|
File details
Details for the file epilearn-0.0.1-py3-none-any.whl.
File metadata
- Download URL: epilearn-0.0.1-py3-none-any.whl
- Upload date:
- Size: 106.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
930ba212615c86d9f883643f569f741c19a2ef39dd1da5496fc225a6211e19f0
|
|
| MD5 |
91b68dff5368817599db32dcc9da6d3e
|
|
| BLAKE2b-256 |
b04c4b57ee50c88af75afae16a514a14e6c7d23c5dd6c7eccd4a2e644c409c81
|