From 1e0767ff0767dd9f032007664eda2436887cbbbb Mon Sep 17 00:00:00 2001 From: Tiffany Tang Date: Wed, 13 Mar 2024 11:45:21 -0400 Subject: [PATCH] fix duplicate vary_params bug (#188) * If the same parameter is varies across different DGPs, only show this parameter once in `vary_params` * Same applies to parameters that are varied across multiple methods * Closes #187 --- R/experiment.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/experiment.R b/R/experiment.R index 5babda9..3a7ef6f 100644 --- a/R/experiment.R +++ b/R/experiment.R @@ -262,7 +262,8 @@ Experiment <- R6::R6Class( return(NULL) } else { return(purrr::map(x, names) %>% - purrr::reduce(c)) + purrr::reduce(c) %>% + unique()) } }) param_names <- purrr::reduce(param_names_ls, c) @@ -390,6 +391,7 @@ Experiment <- R6::R6Class( } return(out_params) }, + .get_obj_params = function(field_name = c("evaluator", "visualizer"), obj_list) { field_name <- match.arg(field_name) @@ -707,6 +709,7 @@ Experiment <- R6::R6Class( paste("Varying", param_names)) return(save_dir) }, + deep_clone = function(name, value) { if (is.list(value) && length(value) > 0 && inherits(value[[1]], "R6")) { lapply(value, function(v) v$clone(deep = TRUE))