Skip to content

Commit

Permalink
Merge pull request facebookexperimental#203 from facebookexperimental…
Browse files Browse the repository at this point in the history
…/gufeng_v3.3.2_dev

Gufeng v3.3.2 dev
  • Loading branch information
gufengzhou authored Nov 2, 2021
2 parents e775ac2 + d12dfec commit f54f429
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 127 deletions.
3 changes: 2 additions & 1 deletion R/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Robyn
Type: Package
Title: Automated Marketing Mix Modeling (MMM) Open Source Beta Project from Facebook Marketing Science
Version: 3.3.1
Version: 3.4.3
Authors@R: c(
person("Gufeng", "Zhou", , "[email protected]", c("aut")),
person("Leonel", "Sentana", , "[email protected]", c("aut")),
Expand All @@ -19,6 +19,7 @@ Imports:
foreach,
future,
ggplot2,
ggridges,
glmnet,
lubridate,
minpack.lm,
Expand Down
1 change: 1 addition & 0 deletions R/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ importFrom(future,availableCores)
importFrom(future,multicore)
importFrom(future,plan)
importFrom(future,sequential)
importFrom(ggridges,geom_density_ridges)
importFrom(glmnet,cv.glmnet)
importFrom(glmnet,glmnet)
importFrom(lubridate,day)
Expand Down
9 changes: 9 additions & 0 deletions R/R/auxiliary.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ get_rsq <- function(true, predicted, p = NULL, df.int = NULL) {
}
return(rsq)
}

# Robyn colors
robyn_palette <- function() {
list(
fill = rep(c("#21130d","#351904","#543005","#8C510A","#BF812D","#DFC27D","#F6E8C3"
,"#F5F5F5","#C7EAE5","#80CDC1","#35978F","#01665E","#043F43", "#04272D"), 2),
colour = rep("#000000", 24)
)
}
4 changes: 3 additions & 1 deletion R/R/imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#' @importFrom foreach foreach %dopar% getDoParWorkers registerDoSEQ
#' @importFrom future multicore plan sequential availableCores
#' @import ggplot2
#' @importFrom ggridges geom_density_ridges
#' @importFrom glmnet cv.glmnet glmnet
#' @importFrom lubridate is.Date day floor_date
#' @importFrom minpack.lm nlsLM
Expand Down Expand Up @@ -58,7 +59,8 @@ dt_vars <- c(
"season", "sequential", "shape", "solID", "spend", "spend_share", "spend_share_refresh",
"theta", "theta_halflife", "total_spend", "trend", "trial", "type", "value", "variable",
"weekday", "x", "xDecompAgg", "xDecompMeanNon0", "xDecompMeanNon0Perc",
"xDecompMeanNon0PercRF", "xDecompMeanNon0RF", "xDecompPerc", "xDecompPercRF", "y", "yhat","respN"
"xDecompMeanNon0PercRF", "xDecompMeanNon0RF", "xDecompPerc", "xDecompPercRF", "y", "yhat",
"respN","iteration","variables","iter_bin", "thetas", "cut_time"
)

if (getRversion() >= "2.15.1") {
Expand Down
315 changes: 193 additions & 122 deletions R/R/model.R

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions R/R/refresh.R
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ robyn_refresh <- function(robyn_object,
pBarRF <- ggplot(data = xDecompAggReportPlot, mapping = aes(x = variable, y = percentage, fill = variable)) +
geom_bar(alpha = 0.8, position = "dodge", stat = "identity") +
facet_wrap(~refreshStatus, scales = "free") +
scale_fill_brewer(palette = "BrBG") +
scale_fill_manual(values = robyn_palette()$fill) +
geom_text(aes(label = paste0(round(percentage * 100, 1), "%")),
size = 3,
position = position_dodge(width = 0.9), hjust = -0.25
Expand All @@ -473,7 +473,7 @@ robyn_refresh <- function(robyn_object,
position = position_dodge(width = 0.9),
data = xDecompAggReportPlot
) +
scale_color_brewer(palette = "BrBG") +
scale_color_manual(values = robyn_palette()$fill) +
scale_y_continuous(
sec.axis = sec_axis(~ . * ySecScale), breaks = seq(0, ymax, 0.2),
limits = c(0, ymax), name = "roi_total"
Expand Down
4 changes: 4 additions & 0 deletions R/man/robyn_run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions demo/debug.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ lambda_control = 1
refresh = FALSE
dt_hyper_fixed = NULL
ui = FALSE
csv_out = "pareto"
seed = 123
# go into robyn_run() line by line

## debug robyn_allocator
Expand Down
2 changes: 1 addition & 1 deletion demo/demo.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# LICENSE file in the root directory of this source tree.

#############################################################################################
#################### Facebook MMM Open Source - Robyn 3.0.0 ######################
#################### Facebook MMM Open Source - Robyn 3.4.3 ######################
#################### Quick guide #######################
#############################################################################################

Expand Down

0 comments on commit f54f429

Please sign in to comment.