Skip to content

Commit

Permalink
update version, minor change in plotting progress bar & typos
Browse files Browse the repository at this point in the history
  • Loading branch information
gufengzhou committed Nov 25, 2021
1 parent 73b39b7 commit 327f732
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 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.4.7
Version: 3.4.8
Authors@R: c(
person("Gufeng", "Zhou", , "[email protected]", c("aut")),
person("Leonel", "Sentana", , "[email protected]", c("aut")),
Expand Down
2 changes: 1 addition & 1 deletion R/R/imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dt_vars <- c(
"optmResponseUnitTotalLift", "optmSpendUnit", "optmSpendUnitTotalDelta", "param",
"perc", "percentage", "pos", "predicted", "refreshStatus", "response", "rn", "robynPareto",
"roi", "roi_mean", "roi_total", "rsq_lm", "rsq_nls", "rsq_train", "s0", "scale_shape_halflife",
"season", "shape", "solID", "spend", "spend_share", "spend_share_refresh",
"season", "shape", "solID", "spend", "spend_share", "spend_share_refresh", "sid",
"theta", "theta_halflife", "total_spend", "trend", "trial", "type", "value", "variable",
"weekday", "x", "xDecompAgg", "xDecompMeanNon0", "xDecompMeanNon0Perc",
"xDecompMeanNon0PercRF", "xDecompMeanNon0RF", "xDecompPerc", "xDecompPercRF", "y", "yhat",
Expand Down
19 changes: 13 additions & 6 deletions R/R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ robyn_run <- function(InputCollect,
"hyperparameters & 10-fold ridge x-validation on 1 core (Windows fallback)"
))
}

# ng_collect <- list()
model_output_collect <- list()

Expand Down Expand Up @@ -468,15 +468,15 @@ robyn_run <- function(InputCollect,
# ggplot doesn't work with process forking on MacOS
# however it works fine on Linux and Windows
parallel_plotting <- Sys.info()["sysname"] != "Darwin"

if (plot_pareto) {
if (parallel_plotting) {
message(paste(">>> Plotting", num_pareto123, "Pareto optimum models on", InputCollect$cores, "cores..."))
} else {
message(paste(">>> Plotting", num_pareto123, "Pareto optimum models on 1 core (MacOS fallback)..."))
}
}

if (parallel_plotting) {
registerDoParallel(InputCollect$cores)
} else {
Expand Down Expand Up @@ -857,6 +857,11 @@ robyn_run <- function(InputCollect,
dt_transformSaturationSpendReverse[, (InputCollect$organic_vars) := NA]
}

if (!parallel_plotting) {
cnt <- cnt + 1
setTxtProgressBar(pbplot, cnt)
}

return(list(
mediaVecCollect = rbind(
dt_transformPlot[, ":="(type = "rawMedia", solID = sid)],
Expand All @@ -872,8 +877,10 @@ robyn_run <- function(InputCollect,
))
} # end solution loop

cnt <- cnt + length(uniqueSol)
setTxtProgressBar(pbplot, cnt)
if (parallel_plotting) {
cnt <- cnt + length(uniqueSol)
setTxtProgressBar(pbplot, cnt)
}

# append parallel run results
mediaVecCollect <- append(mediaVecCollect, lapply(parallelResult, function (x) x$mediaVecCollect))
Expand Down Expand Up @@ -1118,7 +1125,7 @@ robyn_mmm <- function(hyper_collect,

# enable parallelisation of main modelling loop for MacOS and Linux only
parallel_processing <- .Platform$OS.type == "unix"

# create cluster before big for-loop to minimize overhead for parallel backend registering
if (parallel_processing) {
registerDoParallel(InputCollect$cores)
Expand Down
3 changes: 2 additions & 1 deletion R/man/robyn_refresh.Rd

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

3 changes: 2 additions & 1 deletion R/man/robyn_run.Rd

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

4 changes: 2 additions & 2 deletions 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.4.7 ######################
#################### Facebook MMM Open Source - Robyn 3.4.8 ######################
#################### Quick guide #######################
#############################################################################################

Expand Down Expand Up @@ -129,7 +129,7 @@ InputCollect <- robyn_inputs(

,nevergrad_algo = "TwoPointsDE" # recommended algorithm for Nevergrad, the gradient-free
# optimisation library https://facebookresearch.github.io/nevergrad/index.html
,trials = 5 # number of allowed iterations per trial. 5 is recommended without calibration,
,trials = 5 # number of allowed trials. 5 is recommended without calibration,
# 10 with calibration.

# Time estimation: with geometric adstock, 2000 iterations * 5 trials
Expand Down

0 comments on commit 327f732

Please sign in to comment.