Skip to content

Commit 3add082

Browse files
committed
recode: reduce the size of xDecompVec on OutputCollect to only pareto-front models
1 parent bb2738c commit 3add082

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

R/R/model.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,11 @@ robyn_mmm <- function(InputCollect,
935935
arrange(.data$nrmse) %>%
936936
as_tibble()
937937

938-
# if (hyper_fixed) {
939938
resultCollect[["xDecompVec"]] <- bind_rows(
940939
lapply(resultCollectNG, function(x) {
941940
bind_rows(lapply(x, function(y) y$xDecompVec))
942941
})
943942
) %>%
944-
arrange(.data$solID, .data$ds) %>%
945943
as_tibble()
946944
# resultCollect[["xDecompVecImmediate"]] <- bind_rows(
947945
# lapply(resultCollectNG, function(x) {
@@ -957,7 +955,6 @@ robyn_mmm <- function(InputCollect,
957955
# ) %>%
958956
# arrange(.data$nrmse, .data$ds) %>%
959957
# as_tibble()
960-
# }
961958

962959
resultCollect[["xDecompAgg"]] <- bind_rows(
963960
lapply(resultCollectNG, function(x) {

R/R/outputs.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ robyn_outputs <- function(InputCollect, OutputModels,
8686
pareto_fronts <- pareto_results$pareto_fronts
8787
allSolutions <- pareto_results$pareto_solutions
8888

89+
# Reduce the size of xDecompVec with only pareto-front models
90+
temp <- OutputModels[names(OutputModels) %in% paste0("trial", seq(OutputModels$trials))]
91+
temp2 <- lapply(temp, function(x) filter(x$resultCollect$xDecompVec, .data$solID %in% allSolutions))
92+
for (i in seq(OutputModels$trials)) {
93+
OutputModels[[paste0("trial", i)]]$resultCollect$xDecompVec <- temp2[[i]]
94+
}
95+
8996
#####################################
9097
#### Gather the results into output object
9198

0 commit comments

Comments
 (0)