Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SEIR model template #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions templates/seir/WRITEUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# TITLE HERE

## Abstract

## BACKGROUND

## Experiment Descriptions

## Results Summary

Here is how to add a figure.

![figure description](figure_1.png)
[[TODO: Please add a caption beneath every figure.]]

## CONCLUSIONS

## FUTURE WORK
51 changes: 51 additions & 0 deletions templates/seir/experiment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import os
import json
import numpy as np
import argparse
from scipy.integrate import odeint

# -----------------------------------------------------------------------------
# SEIR model is a differential equation model that describes the dynamics of infectious diseases such as COVID-19.
# The model divides the population into four compartments: S (susceptible), E (exposed), I (infectious), and R (recovered).
# -----------------------------------------------------------------------------


parser = argparse.ArgumentParser(description="Run experiment")
parser.add_argument("--out_dir", type=str, default="run_0", help="Output directory")
args = parser.parse_args()

if __name__ == "__main__":
out_dir = args.out_dir
os.makedirs(out_dir, exist_ok=True)

def seir_eq(v, t, beta, lp, ip):
"""Differential equation of SEIR model
v: [S, E, I, R] Distribution of people in each state
t: Time
beta: Infection rate
lp: Latent period
ip: Infectious period
"""
dS = -beta * v[0] * v[2]
dE = beta * v[0] * v[2] - (1 / lp) * v[1]
dI = (1 / lp) * v[1] - (1 / ip) * v[2]
dR = (1 / ip) * v[2]
return np.array([dS, dE, dI, dR])

# Solve SEIR model
init_state = np.array([3000, 0, 5, 0])
solution = odeint(
seir_eq,
init_state,
t=np.arange(0, 100, 1),
args=(0.001, 14, 7),
)

final_info = {
"solution": solution.tolist(),
"infected_peak_day": np.argmax(solution[:, 2]).item(),
"infected_peak": np.max(solution[:, 2]).item(),
"tolal_infected": solution[-1, 3].item(),
}
with open(os.path.join(out_dir, "final_info.json"), "w") as f:
json.dump(final_info, f)
29 changes: 29 additions & 0 deletions templates/seir/ideas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"Name": "threshold_behavioral_response_seir",
"Title": "Modeling Threshold-Based Behavioral Responses in SEIR Dynamics",
"Experiment": "Modify the seir_eq function to implement multiple thresholds for adjusting the contact rate based on the proportion of infected individuals. Define specific behavior change scenarios (e.g., reduced contact rates at 1%, 5%, 10% infection levels) and analyze their impacts on peak infections and total infections. This will allow for a more detailed understanding of how varying public health responses can influence disease spread.",
"Interestingness": 9,
"Feasibility": 8,
"Novelty": 9,
"novel": true
},
{
"Name": "vaccination_strategy_seir",
"Title": "Incorporating Vaccination Strategies into SEIR Dynamics",
"Experiment": "Modify the seir_eq function to add a vaccination compartment (V). Implement various vaccination strategies with defined vaccination rates (e.g., 0.1% per day) and specify vaccine efficacy duration (e.g., 6 months). Conduct sensitivity analyses to assess how varying vaccination rates and durations affect peak infections and total infections over time. Compare immediate, phased, and delayed vaccination strategies in terms of their effectiveness in controlling the outbreak.",
"Interestingness": 9,
"Feasibility": 8,
"Novelty": 8,
"novel": true
},
{
"Name": "dynamic_social_distancing_seir",
"Title": "Modeling Dynamic Social Distancing Responses in SEIR Dynamics",
"Experiment": "Modify the seir_eq function to include a social distancing factor that reduces the infection rate based on the number of infections. Define three levels of social distancing (mild, moderate, strict) triggered at specific infection thresholds. Analyze the outcomes in terms of peak infections, total infections, and the duration of the epidemic, comparing results with and without these distancing measures.",
"Interestingness": 9,
"Feasibility": 9,
"Novelty": 9,
"novel": true
}
]
Loading