From 320606b8ede0f7cb2cdaafa55804d49e43632f11 Mon Sep 17 00:00:00 2001 From: Sima Najafzadehkhoei Date: Tue, 10 Dec 2024 14:48:07 -0700 Subject: [PATCH] updates --- .github/.gitignore | 1 + NAMESPACE | 1 + man/prepare_data.Rd | 19 +++++++++++++++++++ man/run_simulations.Rd | 2 +- man/simulate_calibrate_sir.Rd | 2 +- man/train_model.Rd | 2 +- tests/testthat.R | 4 ++-- vignettes/calibrate.Rmd | 12 ++++++++---- 8 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 .github/.gitignore create mode 100644 man/prepare_data.Rd diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/NAMESPACE b/NAMESPACE index b566a6e..f62ea7c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,6 +7,7 @@ export(filter_non_null) export(filter_non_null_infected) export(generate_theta) export(plot_results) +export(prepare_data) export(prepare_data_for_tensorflow) export(prepare_data_infected) export(preprocessing_data) diff --git a/man/prepare_data.Rd b/man/prepare_data.Rd new file mode 100644 index 0000000..b623611 --- /dev/null +++ b/man/prepare_data.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dataprep.R +\name{prepare_data} +\alias{prepare_data} +\title{Prepare Data for TensorFlow Model: General SIR Data Preparation} +\usage{ +prepare_data(m, max_days = max_days) +} +\arguments{ +\item{m}{An \code{epiworldR} model object.} + +\item{max_days}{The maximum number of days to consider for data preparation. Defaults to 50.} +} +\value{ +A reshaped array of processed data suitable for TensorFlow models. If an error occurs, it returns the error object. +} +\description{ +Prepare Data for TensorFlow Model: General SIR Data Preparation +} diff --git a/man/run_simulations.Rd b/man/run_simulations.Rd index c6a3816..5d7572d 100644 --- a/man/run_simulations.Rd +++ b/man/run_simulations.Rd @@ -4,7 +4,7 @@ \alias{run_simulations} \title{Run SIR Model Simulations} \usage{ -run_simulations(N, n, ndays, ncores, theta, seeds, path) +run_simulations(N, n, ndays, ncores, theta, seeds) } \arguments{ \item{N}{Integer. The number of simulations to run.} diff --git a/man/simulate_calibrate_sir.Rd b/man/simulate_calibrate_sir.Rd index cc833eb..18d43c8 100644 --- a/man/simulate_calibrate_sir.Rd +++ b/man/simulate_calibrate_sir.Rd @@ -4,7 +4,7 @@ \alias{simulate_calibrate_sir} \title{simulate calibrate sir Function} \usage{ -simulate_calibrate_sir(N, n, ndays, ncores) +simulate_calibrate_sir(N, n, ndays, ncores, epochs, verbose) } \arguments{ \item{N}{Integer. The number of simulations to run.} diff --git a/man/train_model.Rd b/man/train_model.Rd index d891d28..c2a80c5 100644 --- a/man/train_model.Rd +++ b/man/train_model.Rd @@ -4,7 +4,7 @@ \alias{train_model} \title{Train the CNN Model} \usage{ -train_model(model, train_data, epochs = 100) +train_model(model, train_data, epochs = epochs, verbose = verbose) } \arguments{ \item{model}{Keras model. The compiled model to be trained.} diff --git a/tests/testthat.R b/tests/testthat.R index 268608c..3342db3 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -7,6 +7,6 @@ # * https://testthat.r-lib.org/articles/special-files.html library(testthat) -library(myfirst.package) +library(epiworldRcalibrate) -test_check("myfirst.package") +test_check("epiworldRcalibrate") diff --git a/vignettes/calibrate.Rmd b/vignettes/calibrate.Rmd index 04eda40..5c7660f 100644 --- a/vignettes/calibrate.Rmd +++ b/vignettes/calibrate.Rmd @@ -18,19 +18,23 @@ The vignette guides you through the different stages of the function, including ## Prerequisites Ensure that the following libraries are installed and loaded: - -```{r} -library(epiworldRcalibrate) +```{r setup, include = FALSE} +knitr::opts_chunk$set( + eval = FALSE, # Globally disables evaluation of all chunks + echo = TRUE # Shows code in the vignette but does not run it +) ``` + + ```{r} library(epiworldR) -library(epiworldRcalibrate) library(keras3) library(data.table) library(tensorflow) library(reticulate) reticulate::import("numpy") +library(epiworldRcalibrate) ``` # Function Overview