facebookexperimental / Robyn

Robyn is an experimental, AI/ML-powered and open sourced Marketing Mix Modeling (MMM) package from Meta Marketing Science. Our mission is to democratise modeling knowledge, inspire the industry through innovation, reduce human bias in the modeling process & build a strong open source marketing science community.
https://facebookexperimental.github.io/Robyn/
MIT License
1.07k stars 323 forks source link

Subsequent Robyn Refresh Penalty Hyperparameters #971

Closed lesherc closed 1 month ago

lesherc commented 1 month ago

Project Robyn

Describe issue

For my initial model, I use add_penalty_factor = TRUE as a parameter in my robyn_run() This didn't seem to be an issue for my first refresh, as I was able to move through the process without errors and export an updated model with the sliding date range. For my second refresh, I am being presented with the following error:

RobynRefreshApr <- robyn_refresh(
  json_file = refresh_model,
  dt_input = dt_daily_refresh1,
  dt_holidays = dt_prophet_holidays,
  refresh_steps = 34,
  refresh_iters = 6000,
  refresh_trials = 3
)
Recreating model 1_523_11
Imported JSON file successfully: /Users/corylesher/Documents/Robyn/Robyn_202405011626_init/Robyn_202405020750_rf1/RobynModel-1_523_11.json
Error in check_hyperparameters(hyperparameters, adstock, paid_media_spends,  : 
  Input 'hyperparameters' contains following wrong names: branded_search_penalty, digital_other_penalty, facebook_acq_spend_penalty, fb_ret_spend_penalty, google_nonbranded_spend_penalty, mail_spend_penalty, nonfbplatform_acq_spend_penalty, season_penalty, tv_spend_penalty, weekday_penalty

Environment & Robyn version

lesherc commented 1 month ago

I was able to get the refresh to run by deleting the terms within the json file

      "season_penalty": [ , ],
      "weekday_penalty": [ , ],
      "fb_ret_spend_penalty": [ , ],
      "tv_spend_penalty": [ , ],
      "branded_search_penalty": [ , ],
      "digital_other_penalty": [ , ],
      "google_nonbranded_spend_penalty": [ , ],
      "mail_spend_penalty": [ , ],
      "facebook_acq_spend_penalty": [ , ],
      "nonfbplatform_acq_spend_penalty": [ , ]

I noticed the initial model doesn't save them in InputCollect, but perhaps they're being written in the wrong place? For example, "hyper_updated": { uses a [0,1] range for these in both the initial model and the updated output with a refresh?

gufengzhou commented 1 month ago

Thanks for reporting this. I could reproduce the error and just pushed a fix. I've tested it on multiple refreshes and worked for me. Please update to the latest github version and retry.

@laresbernardo FYI, a refresh fix

lesherc commented 1 month ago

Updating to ‘3.10.7’ didn't fix the error, let me know if there's something I'm missing on my end.

laresbernardo commented 1 month ago

Did you install and refresh your R session so it loads the latest version? @lesherc does the issue persist?

lesherc commented 1 month ago

Good call, sorry about that. Can confirm this has been solved— thanks for the quick help!