Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run f.inputWrangling() #27

Closed
fedemendez1 opened this issue Mar 10, 2021 · 9 comments · Fixed by #30
Closed

Can't run f.inputWrangling() #27

fedemendez1 opened this issue Mar 10, 2021 · 9 comments · Fixed by #30

Comments

@fedemendez1
Copy link

I am trying to run fb_robyn.exec.R and I get this error message in this line of code:

Prepare input data

dt_mod <- f.inputWrangling()

The error message says:

Error in value[3L] : unused argument (cond)

And the traceback:

  1. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  2. tryCatchList(expr, classes, parentenv, handlers)
  3. tryCatch({
    dateCheck <- as.matrix(dt_transform[, set_dateVarName, with = F])
    dateCheck <- as.Date(dateCheck)
    }, error = function() { ... at fb_robyn.func.R#79
  4. f.inputWrangling()

I saw the same error in another issue, but with no solution so I am re-asking. Thanks very much

@gufengzhou
Copy link
Contributor

hi, thanks for reporting this. we'll push the fix asap and let you know. probably today/tomorrow.

@gufengzhou
Copy link
Contributor

just pushed the fix, which was related to checking if the DATE format is set correctly. hope it works now?

@LeoUbbiali
Copy link

LeoUbbiali commented Mar 10, 2021

Hi @gufengzhou Thanks for pushing the fix.
I encountered the same error previously and now I get this new error.
I hope you could help

code run
dt_mod <- f.inputWrangling()

error

Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates

traceback

stop("singular gradient matrix at initial parameter estimates")
9.
nlsModel(formula, mf, start, wts)
8.
nlsLM(reach ~ Vmax * spend/(Km + spend), data = dt_spendModInput,
start = nlsStartVal, control = nls.control(warnOnly = T)) at fb_robyn.func.R#326
7.
withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
6.
suppressWarnings(modNLS <- nlsLM(reach ~ Vmax * spend/(Km + spend),
data = dt_spendModInput, start = nlsStartVal, control = nls.control(warnOnly = T))) at fb_robyn.func.R#326
5.
value[3L]
4.
tryCatchOne(expr, names, parentenv, handlers[[1L]])
3.
tryCatchList(expr, classes, parentenv, handlers)
2.
tryCatch({
nlsStartVal <- list(Vmax = dt_spendModInput[, max(reach)/2],
Km = dt_spendModInput[, max(reach)])
modNLS <- minpack.lmnlsLM(reach ~ Vmax * spend/(Km + spend), ... at fb_robyn.func.R#316
1.
f.inputWrangling()

@gufengzhou
Copy link
Contributor

alright this is a tricky one. you're using your own data, right? probably also using some non-spend metrics for set_mediaVarName? This error is related to the spend-reach nonlinear fitting. please try using all spends in set_mediaVarName first and see if everything runs. If yes, then try changing it to impressions etc one by one, so you can see which channel is having problem.

@LeoUbbiali
Copy link

Hey @gufengzhou thanks a lot for the quick reply.
Yes, that's correct:

  • I'm using my own data
  • I'm using the non-spend variables for set_mediaVarName (using the corresponding "pressure" metric for each spend metric. I have a 1 pressure metric and one spend metric for each "channel")

Could you please expand/point to underlying model documentation on "This error is related to the spend-reach nonlinear fitting"?

Anyway, I'll follow your advice and then report back.

@gufengzhou
Copy link
Contributor

hey, I've pushed a fix for the nls spend reach fitting. hopefully it works now for you. otherwise let me know. regarding documentation, sorry that this is not updated yet. It's fitting the exposure metrics (imps, clicks, GRP etc.) using spends, when you're using non-spend metrics as media variables. For example if you use imp for FB, spend-reach model will fit FB imp with FB spend. This is aiming to better model the nonlinear relationship between spend and exposure and thus enable better ROI calculation, cost-response curve and finally budget allocation. You can check the detail in script .func from line 280 on. hope it helps.

@gufengzhou gufengzhou reopened this Mar 11, 2021
@fedemendez1
Copy link
Author

Thank you for the push, I managed to run f.inputWrangling() successfully now.

When running the following line of code now, I get an error saying 'Error: Miniconda installation failed [unknown reason]'

Is this Miniconda something I need in my pc to be able to run it? Not familiar.

Thanks for the comments

model_output_collect <- f.robyn(set_hyperBoundLocal
,optimizer_name = set_hyperOptimAlgo
,set_trial = set_trial
,set_cores = set_cores
,plot_folder = "~/Documents/GitHub/plots") # please set your folder path to save plots. It ends without "/".

@gufengzhou
Copy link
Contributor

Yes, you need to install anaconda first, then install Nevergrad (which is a Python library) through conda. In the .exec script there is a simple guide after the libraries

@LeoUbbiali
Copy link

Thanks @gufengzhou . My issue was solved by the latest commit. I didn't need to manually loop over the Spend-Media pairs to find the one who did not fit.
Thanks also for updating the step by step guide.

@gufengzhou gufengzhou mentioned this issue Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants