Skip to content

Commit

Permalink
fix: logic in baseline calcs
Browse files Browse the repository at this point in the history
  • Loading branch information
laresbernardo committed May 13, 2024
1 parent 0483f49 commit da7acfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/robyn.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ robyn_modelselector <- function(
group_by(.data$solID) %>%
mutate(baseline = .data$contribution / sum(.data$contribution)) %>% ungroup() %>%
filter(.data$rn == "baseline") %>%
mutate(baseline_dist = abs(1 - abs(.data$baseline - baseline_ref) / abs(.data$baseline))) %>%
arrange(.data$baseline_dist) %>%
select(c("solID", "baseline", "baseline_dist"))
arrange(abs(.data$baseline)) %>%
mutate(baseline_dist = 1 - normalize(abs(baseline_ref - .data$baseline))) %>%
select(c("solID", "baseline", "baseline_dist")) %>%
arrange(desc(.data$baseline_dist))

# Gather everything up
dfa <- OutputCollect$allPareto$resultHypParam %>%
Expand Down

0 comments on commit da7acfe

Please sign in to comment.