From fdb97291e02f72c7f76b5bede86f71f0889c2990 Mon Sep 17 00:00:00 2001 From: laresbernardo Date: Mon, 23 Dec 2024 12:23:33 +0100 Subject: [PATCH] fix: penalization shoudn't be 0 --- DESCRIPTION | 2 +- R/robyn.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0f73c66f..1cc84101 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: lares Type: Package Title: Analytics & Machine Learning Sidekick -Version: 5.2.10.9003 +Version: 5.2.10.9004 Authors@R: c( person("Bernardo", "Lares", , "laresbernardo@gmail.com", c("aut", "cre"))) Maintainer: Bernardo Lares diff --git a/R/robyn.R b/R/robyn.R index dfdbe0db..bfc5e0a7 100644 --- a/R/robyn.R +++ b/R/robyn.R @@ -461,8 +461,8 @@ certainty_score <- function( mutate(Si = ifelse(spend_wt == FALSE, 1, .data$spend / sum(.data$spend))) %>% ungroup() %>% mutate( - pen = ifelse(.data$P < .data$Pmax & .data$P > .data$Pmin, 0, penalization), - Xi = .data$Si * ((.data$P - .data$Pi)^2 * pen) + pen = ifelse(.data$P < .data$Pmax & .data$P > .data$Pmin, 1, penalization), + Xi = .data$Si * ((.data$P - .data$Pi)^2 * .data$pen) ) %>% group_by(.data$solID, .data$cluster) %>% summarize(Mi = sum(.data$Xi, na.rm = TRUE), .groups = "drop") %>%