Caching does not work for `xy_dgp_constructor`
tiffanymtang opened this issue · 1 comments
tiffanymtang commented
Caching does not work when using xy_dgp_constructor()
to construct a DGP
. When comparing the cached experiment parameters to the current experiment parameters (i.e., in n_reps_cached <- private$.n_reps_cached(cached_params$fit)
), the result is that none of the current experiment parameters have been previously cached and so n_reps_cached = 0
. I think the .dgp_params
column in the tibble is the issue. Parameters like x_fun
and y_fun
cannot be easily compared because they are functions with their own environments.
Example:
dgp <- create_dgp(
.dgp_fun = xy_dgp_constructor,
.name = 'Uncorrelated Gaussian Linear DGP',
x_fun = generate_X_gaussian,
y_fun = generate_y_linear,
n = 200,
p = 10,
betas = c(rep(1, 5), rep(0, 5))
)
method <- create_method(
.method_fun = function(X, y, support) return(rnorm(1))
)
experiment <- create_experiment() %>%
add_dgp(dgp) %>%
add_method(method)
results <- run_experiment(experiment, save = TRUE)
cached_results <- run_experiment(experiment, use_cached = TRUE, save = FALSE)
all.equal(results, cached_results)
jpdunc23 commented
Moved to dgpoix
.