Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sima-njf authored Dec 10, 2024
1 parent f82fbe0 commit bf33da0
Showing 1 changed file with 5 additions and 36 deletions.
41 changes: 5 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
## 📊 simulate_calibrate_sir() and 🔧 calibrate_sir()

### ✍️ Authors: George Vega Yon, Sima NJF
# 🌍 Introduction

Predicting the trajectory of infectious diseases lies at the heart of public health preparedness. With the epiworldRcalibrate package, you can effortlessly simulate and calibrate SIR (Susceptible-Infected-Recovered) epidemic models, blending the power of R, TensorFlow, and Keras. You can swiftly bridge the gap between theory and practice by generating realistic epidemic scenarios and training advanced Convolutional Neural Networks (CNNs) to identify key parameters—like prevalence, contact rate, transmission probability, and recovery precision.

The 🚀 simulate_calibrate_sir() function empowers you to produce synthetic incidence data and refine your model’s parameters through deep learning. Complementing this, 🔧 calibrate_sir() takes observed data, returning carefully tuned parameters ready for further analysis. Together, these tools streamline the modeling-to-inference pipeline, guiding you toward more informed, data-driven decisions in epidemiological research and public health policy.

### 🚀 simulate_calibrate_sir()

Expand Down Expand Up @@ -31,42 +36,6 @@ epochs <- 2
verbose <- 2
```
```{r}
simulate_calibrate_sir <- function(N, n, ndays, ncores, epochs, verbose) {
# ⚙️ Generate Theta and Seeds
theta <- generate_theta(N, n)
seeds <- sample.int(.Machine$integer.max, N, TRUE)
# 🧪 Run Simulations
matrices <- run_simulations(N, n, ndays, ncores, theta, seeds)
# 🔍 Filter Non-Null Data
filtered_data <- filter_non_null(matrices, theta)
matrices <- filtered_data$matrices
theta <- filtered_data$theta
N <- filtered_data$N
# 📊 Prepare Data for TensorFlow
arrays_1d <- prepare_data_for_tensorflow(matrices, N)
theta2 <- as.data.table(copy(theta))
theta2$crate <- plogis(theta2$crate / 10)
# 🔀 Split Data into Training and Testing Sets
data_split <- split_data(arrays_1d, theta2, N)
train <- data_split$train
test <- data_split$test
# 🏗️ Build and Train the CNN Model
model <- build_cnn_model(dim(arrays_1d)[-1], ncol(theta))
train_model(model, train, epochs = epochs, verbose = verbose)
# 📈 Evaluate the Model
eval_results <- evaluate_model(model, test, theta)
pred <- eval_results$pred
MAEs <- eval_results$MAEs
plot_results(pred, test, theta, MAEs, N, floor(N * 0.7))
return(list(pred = pred, MAEs = MAEs))
}
# ▶️ Call the function
simulate_calibrate_sir(N, n, ndays, ncores, epochs, verbose)
```
Expand Down

0 comments on commit bf33da0

Please sign in to comment.