Skip to content

Commit

Permalink
recode: reduce the size of xDecompVec on OutputCollect to only pareto…
Browse files Browse the repository at this point in the history
…-front models
  • Loading branch information
laresbernardo committed Nov 23, 2022
1 parent bb2738c commit 3add082
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 0 additions & 3 deletions R/R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -935,13 +935,11 @@ robyn_mmm <- function(InputCollect,
arrange(.data$nrmse) %>%
as_tibble()

# if (hyper_fixed) {
resultCollect[["xDecompVec"]] <- bind_rows(
lapply(resultCollectNG, function(x) {
bind_rows(lapply(x, function(y) y$xDecompVec))
})
) %>%
arrange(.data$solID, .data$ds) %>%
as_tibble()
# resultCollect[["xDecompVecImmediate"]] <- bind_rows(
# lapply(resultCollectNG, function(x) {
Expand All @@ -957,7 +955,6 @@ robyn_mmm <- function(InputCollect,
# ) %>%
# arrange(.data$nrmse, .data$ds) %>%
# as_tibble()
# }

resultCollect[["xDecompAgg"]] <- bind_rows(
lapply(resultCollectNG, function(x) {
Expand Down
7 changes: 7 additions & 0 deletions R/R/outputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ robyn_outputs <- function(InputCollect, OutputModels,
pareto_fronts <- pareto_results$pareto_fronts
allSolutions <- pareto_results$pareto_solutions

# Reduce the size of xDecompVec with only pareto-front models
temp <- OutputModels[names(OutputModels) %in% paste0("trial", seq(OutputModels$trials))]
temp2 <- lapply(temp, function(x) filter(x$resultCollect$xDecompVec, .data$solID %in% allSolutions))
for (i in seq(OutputModels$trials)) {
OutputModels[[paste0("trial", i)]]$resultCollect$xDecompVec <- temp2[[i]]
}

#####################################
#### Gather the results into output object

Expand Down

0 comments on commit 3add082

Please sign in to comment.