Skip to main content

A Pytorch library for machine learning in epidemic modeling

Project description

EpiLearn

Epidemic Modeling with Pytorch

Documentation Status License MIT

Documentation

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epilearn-0.0.1.tar.gz (81.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epilearn-0.0.1-py3-none-any.whl (106.7 kB view details)

Uploaded Python 3

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

Hashes for epilearn-0.0.1.tar.gz
Algorithm Hash digest
SHA256 86e818cf0c16ce0345fe6150ee636c98013f97397c15021c9981888df32f58da
MD5 afa84e0db966e3b49a443974f74218d7
BLAKE2b-256 2c65bf40599a6825e935f342296c99de75c2fff0302a40d0cce150e6ecda29ef

See more details on using hashes here.

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

Hashes for epilearn-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 930ba212615c86d9f883643f569f741c19a2ef39dd1da5496fc225a6211e19f0
MD5 91b68dff5368817599db32dcc9da6d3e
BLAKE2b-256 b04c4b57ee50c88af75afae16a514a14e6c7d23c5dd6c7eccd4a2e644c409c81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page