Closed NikolayLutsyak closed 2 years ago
Hey there - thanks for flagging this issue, I was able to replicate this and created a branch with a fix for the bug. Could you test the branch on your end and make sure you are getting the expected results and everything is working for you? Thank you! https://github.com/facebookexperimental/Robyn/tree/weibull_testfix
FYI: to install that version, simply run remotes::install_github("facebookexperimental/Robyn/R@weibull_testfix")
, restart your session and re-run the code. Thanks for testing @NikolayLutsyak
Thank you for so fast hotfix! I have tested weibull_testfix branch, training with weibull adstock starts and seems to work, but I am getting enormous amount of warnings now:
Warning message in foreach(i = 1:iterPar) %dorng% {:
“Foreach loop (doParallelMC) had changed the current RNG type: RNG was restored to same type, next state”
Is it ok and is it possible to suppress them somehow?
Can you check if you have doRNG (>= 1.8.2)? Run packageVersion("doRNG")
Based on this ticket
Yes, packageVersion("doRNG")
return 1.8.2
What is interesting this warning appears only when cores = 1
in robyn_run
, for cores > 1 everything is OK.
And I still got error Error in {: task 1 failed - "'from' must be a finite number"
but now it is in new place.
robyn_run works correctly
OutputModels <- robyn_run(
InputCollect = InputCollect # feed in all model specification
, cores = 20 # default
, iterations = 2000 # recommended for the dummy dataset
, trials = 1 # recommended for the dummy dataset
, outputs = FALSE # outputs = FALSE disables direct model output
)
after that I am trying to run robyn_outputs:
OutputCollect <- robyn_outputs(
InputCollect, OutputModels
, pareto_fronts = 3
, csv_out = "pareto"
, clusters = TRUE
, plot_pareto = TRUE
, plot_folder = robyn_object
)
and got such stack trace:
Error in {: task 1 failed - "'from' must be a finite number"
Traceback:
1. robyn_outputs(InputCollect, OutputModels, pareto_fronts = 3,
. csv_out = "pareto", clusters = TRUE, plot_pareto = TRUE,
. plot_folder = robyn_object)
2. robyn_pareto(InputCollect, OutputModels, pareto_fronts, calibration_constraint)
3. foreach(respN = seq_along(decompSpendDistPar$rn), .combine = rbind) %dorng%
. {
. get_resp <- robyn_response(media_metric = decompSpendDistPar$rn[respN],
. select_model = decompSpendDistPar$solID[respN], metric_value = decompSpendDistPar$mean_spend[respN],
. dt_hyppar = resultHypParamPar, dt_coef = xDecompAggPar,
. InputCollect = InputCollect, OutputCollect = OutputModels)$response
. dt_resp <- data.table(mean_response = get_resp, rn = decompSpendDistPar$rn[respN],
. solID = decompSpendDistPar$solID[respN])
. return(dt_resp)
. }
4. do.call("%dopar%", list(obj, ex), envir = parent.frame())
5. structure(list(args = seq_along(decompSpendDistPar$rn)(.doRNG.stream = list(
. c(10407L, -1053767131L, -126173022L, -155812933L, 1344574400L,
. -1668607807L, 2079799182L), c(10407L, 1823119202L, 1086938690L,
. -1979133974L, -772903951L, -160941931L, 1697990691L), c(10407L,
. -214602518L, -1819828941L, -1261338095L, 2120158377L, -904661020L,
. -1719827412L), c(10407L, -2127710281L, -1506399862L, 1922222791L,
. 2075338323L, 1152645175L, -294540215L), c(10407L, -381162302L,
. -171568343L, 2082427467L, -1183117886L, -1330589025L, 790224011L
.........................................................................................................................................
. 34194177L, -629284681L, -271792460L, 1610391965L, 450799667L
. ), c(10407L, -1298508154L, -96438104L, -857743339L, 688467565L,
. -135254522L, 391531769L))), argnames = c("respN", ".doRNG.stream"
. ), evalenv = <environment>, specified = character(0), combineInfo = list(
. fun = function (..., deparse.level = 1)
. .Internal(rbind(deparse.level, ...)), in.order = TRUE, has.init = FALSE,
. init = NULL, final = NULL, multi.combine = TRUE, max.combine = 100),
. errorHandling = "stop", packages = "doRNG", export = NULL,
. noexport = NULL, options = list(), verbose = FALSE), class = "foreach") %dopar%
. {
. {
. rngtools::RNGseed(.doRNG.stream)
. }
. {
. get_resp <- robyn_response(media_metric = decompSpendDistPar$rn[respN],
. select_model = decompSpendDistPar$solID[respN],
. metric_value = decompSpendDistPar$mean_spend[respN],
. dt_hyppar = resultHypParamPar, dt_coef = xDecompAggPar,
. InputCollect = InputCollect, OutputCollect = OutputModels)$response
. dt_resp <- data.table(mean_response = get_resp, rn = decompSpendDistPar$rn[respN],
. solID = decompSpendDistPar$solID[respN])
. return(dt_resp)
. }
. }
6. e$fun(obj, substitute(ex), parent.frame(), e$data)
It seems to me that problem could be in such strings:
./R/R/pareto.R:191: x_list <- adstock_weibull(x = m, shape = shape, scale = scale, windlen = InputCollect$rollingWindowLength, type = "cdf")
./R/R/pareto.R:195: x_list <- adstock_weibull(x = m, shape = shape, scale = scale, windlen = InputCollect$rollingWindowLength, type = "pdf")
./R/R/model.R:1081: x_list <- adstock_weibull(x = media_vec, shape = shape, scale = scale, windlen = InputCollect$rollingWindowLength, type = "cdf")
./R/R/model.R:1085: x_list <- adstock_weibull(x = media_vec, shape = shape, scale = scale, windlen = InputCollect$rollingWindowLength, type = "pdf")
I removed windlen = InputCollect$rollingWindowLength,
from this files and tested locally, everything works fine (but I don't know whether it can break some logic of calculations). I didn't manage to push my changes to repo also
Thanks for taking a look at that - that was the problematic condition in the original part, so it should be okay to remove in the rest. I'll work on updating it today.
Just pushed the fix into main, thanks again for flagging this and working with us to get it solved! #355
@kyletgoldberg if this is in main do I need to run this
remotes::install_github("facebookexperimental/Robyn/R@weibull_testfix")
?
I'm getting the same error
Error in { : task 1 failed - "'from' must be a finite number"
@jsatani-tonal, R couldn't execute remotes::install_github("facebookexperimental/Robyn/R@weibull_testfix")
for me ("URL not found"), but after running remotes::install_github("facebookexperimental/Robyn/R")
, i.e. reinstalling Robyn, I was able to run demo.R with the weibull_cdf
adstock function (with an appropriate set of hyperparameters).
Yes! Makes sense. That’s because that was the branch were we fixed this issue, but now it’s been merged into master. So thanks for confirming @mast4461
Project Robyn
Describe issue
Hi! Thank you for a great library! I faced some problem while using Robyn and can't solve it by myself. I am trying to run demo example with
adstock = "weibull_cdf"
and getting such error:The thing is that with
adstock = "geometric"
everything works fine and I managed to fit model and obtain results. But with weibull_cdf I got this strange error. I tried to setcores = 1
, but that didn't help. Full stdout/stderr:Provide dummy data & model configuration
I am trying to do robyn_run with data from demo example and my configuration is absolutely the same as in demo.R except for adstock (and hyperparameters list was changed to match weibull parameters):
Environment & Robyn version
packageVersion("Robyn")
returns 3.6.1sessionInfo()
returns: