Skip to content

Commit 094ea5e

Browse files
author
Gufeng Zhou
committed
added csv_out to allow all iteratiosns in csv output
1 parent 5a46c9d commit 094ea5e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

R/R/model.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#' lambda.min and lambda.1se.
2929
#' @param refresh Boolean. Set to \code{TRUE} when used in \code{robyn_refresh()}.
3030
#' @param seed Integer. For reproducible results when running nevergrad.
31+
#' @param csv_out Character. Accepts "pareto" or "all". Default to "pareto". Set
32+
#' to "all" will output all iterations as csv.
3133
#' @param ui Boolean. Save additional outputs for UI usage. List outcome.
3234
#' @examples
3335
#' \dontrun{
@@ -48,6 +50,7 @@ robyn_run <- function(InputCollect,
4850
refresh = FALSE,
4951
dt_hyper_fixed = NULL,
5052
seed = 123L,
53+
csv_out = "pareto",
5154
ui = FALSE) {
5255

5356
#####################################
@@ -848,8 +851,14 @@ robyn_run <- function(InputCollect,
848851

849852
allSolutions <- xDecompVecCollect[, unique(solID)]
850853

851-
fwrite(resultHypParam[solID %in% allSolutions], paste0(plot_folder, "/", plot_folder_sub, "/", "pareto_hyperparameters.csv"))
852-
fwrite(xDecompAgg[solID %in% allSolutions], paste0(plot_folder, "/", plot_folder_sub, "/", "pareto_aggregated.csv"))
854+
if (!csv_out %in% c("pareto", "all")) csv_out <- "pareto"
855+
if (csv_out == "pareto") {
856+
fwrite(resultHypParam[solID %in% allSolutions], paste0(plot_folder, "/", plot_folder_sub, "/", "pareto_hyperparameters.csv"))
857+
fwrite(xDecompAgg[solID %in% allSolutions], paste0(plot_folder, "/", plot_folder_sub, "/", "pareto_aggregated.csv"))
858+
} else if (csv_out == "all") {
859+
fwrite(resultHypParam, paste0(plot_folder, "/", plot_folder_sub, "/", "all_hyperparameters.csv"))
860+
fwrite(xDecompAgg, paste0(plot_folder, "/", plot_folder_sub, "/", "all_aggregated.csv"))
861+
}
853862
fwrite(mediaVecCollect, paste0(plot_folder, "/", plot_folder_sub, "/", "pareto_media_transform_matrix.csv"))
854863
fwrite(xDecompVecCollect, paste0(plot_folder, "/", plot_folder_sub, "/", "pareto_alldecomp_matrix.csv"))
855864

R/man/robyn_run.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/debug.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ lambda_control = 1
2020
refresh = FALSE
2121
dt_hyper_fixed = NULL
2222
ui = FALSE
23+
csv_out = "pareto"
2324
seed = 123
2425
# go into robyn_run() line by line
2526

0 commit comments

Comments
 (0)