diff --git a/R/DESCRIPTION b/R/DESCRIPTION index d76c06bba..13ea8abc5 100644 --- a/R/DESCRIPTION +++ b/R/DESCRIPTION @@ -1,7 +1,7 @@ Package: Robyn Type: Package Title: Semi-Automated Marketing Mix Modeling (MMM) from Meta Marketing Science -Version: 3.12.0.9001 +Version: 3.12.0.9002 Authors@R: c( person("Gufeng", "Zhou", , "gufeng@meta.com", c("cre", "aut")), person("Igor", "Skokan", , "igorskokan@meta.com", c("aut")), diff --git a/R/R/clusters.R b/R/R/clusters.R index 621b22a67..b90b871a0 100644 --- a/R/R/clusters.R +++ b/R/R/clusters.R @@ -343,6 +343,7 @@ errors_scores <- function(df, balance = rep(1, 3), ts_validation = TRUE, ...) { } .min_max_norm <- function(x, min = 0, max = 1) { + x[is.nan(x)] <- max x <- x[is.finite(x)] x <- x[!is.na(x)] if (length(x) <= 1) { diff --git a/R/R/plots.R b/R/R/plots.R index 8f94e6e05..a0e3e6d03 100644 --- a/R/R/plots.R +++ b/R/R/plots.R @@ -538,7 +538,6 @@ robyn_onepagers <- function( ## 5. Fitted vs actual xDecompVecPlotMelted <- temp[[sid]]$plot5data$xDecompVecPlotMelted %>% mutate( - linetype = ifelse(.data$variable == "predicted", "solid", "dotted"), variable = stringr::str_to_title(.data$variable), ds = as.Date(.data$ds, origin = "1970-01-01") ) @@ -546,7 +545,7 @@ robyn_onepagers <- function( xDecompVecPlotMelted, aes(x = .data$ds, y = .data$value, color = .data$variable) ) + - geom_path(aes(linetype = .data$linetype), size = 0.6) + + geom_path(aes(linetype = .data$variable), size = 0.5) + theme_lares(background = "white", legend = "top", pal = 2) + scale_y_abbr() + guides(linetype = "none") + @@ -1332,7 +1331,6 @@ refresh_plots_json <- function(json_file, plot_folder = NULL, listInit = NULL, d if (!is.null(df)) { xDecompVecPlotMelted <- df$plot5data$xDecompVecPlotMelted %>% mutate( - linetype = ifelse(.data$variable == "predicted", "solid", "dotted"), variable = stringr::str_to_title(.data$variable), ds = as.Date(.data$ds, origin = "1970-01-01") ) @@ -1358,7 +1356,7 @@ refresh_plots_json <- function(json_file, plot_folder = NULL, listInit = NULL, d )) %>% as_tibble() outputs[["pFitRF"]] <- pFitRF <- ggplot(xDecompVecPlotMelted) + - geom_path(aes(x = .data$ds, y = .data$value, color = .data$variable, linetype = .data$linetype), size = 0.6) + + geom_path(aes(x = .data$ds, y = .data$value, color = .data$variable, linetype = .data$variable), size = 0.5) + geom_rect( data = dt_refreshDates, aes(