diff --git a/README.md b/README.md index c7f1103..4fda2c5 100644 --- a/README.md +++ b/README.md @@ -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() @@ -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) ```