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.08k stars 322 forks source link

robyn_recreate() gives a zero coef #855

Closed cnorthcuttm6 closed 2 months ago

cnorthcuttm6 commented 7 months ago

Project Robyn

Describe issue

When running the robyn_recreate() function one of my coefs is zero, however, it is not so in the json file.

json for the variable:

  {
    "variable": "GA_CONV_P_s",
    "coef": 6885.7867,
    "decompPer": 0.0259,
    "decompAgg": 51225.1846,
    "performance": 1.6774,
    "mean_response": 1647.9098,
    "mean_spend": 876.6354,
    "boot_mean": 1.4668,
    "ci_low": 0.601,
    "ci_up": 2.3338
  },

`json_path = "~/json/RobynModel-2_261_1.json"

data <- data.frame(read_sheet(id, "df")) data("dt_prophet_holidays")

Recreate the model

RobynRecreated <- robyn_recreate( json_file = json_path, dt_input = data, dt_holidays = dt_prophet_holidays, quiet = FALSE) InputCollect <- RobynRecreated$InputCollect OutputCollect <- RobynRecreated$OutputCollect `

`

OutputCollect[["xDecompAgg"]][["rn"]] [1] "(Intercept)" "trend" "season" "weekday" "holiday" "product_launch" "promo" "META_CONV_P_s"
[9] "META_CONV_R_s" "META_MU_s" "META_RTN_s" "GA_CONV_P_s" "GA_CONV_R_s" "GA_RTN_s" "TIKTOK_s" "PR__s"
[17] "organic_sessions" "email_clicks" "sms_clicks"

OutputCollect[["xDecompAgg"]][["coef"]] [1] 0.000000e+00 2.398340e-01 1.321053e-01 1.207427e-01 0.000000e+00 1.061000e+05 1.194420e+04 1.562454e+05 1.356358e+05 4.478799e+05 1.241485e+04 0.000000e+00 [13] 0.000000e+00 0.000000e+00 5.151196e+05 4.445166e+03 6.229068e+05 1.671985e+05 1.729456e+05 `

Environment & Robyn version

Make sure you're using the latest Robyn version before you post an issue.

R.version$version.string [1] "R version 4.3.1 (2023-06-16)"

packageVersion("Robyn") [1] ‘3.10.3’

bart-vanvlerken commented 7 months ago

I'm having the same issue, the JSON produces a different model for me. Let me know if you've found a solution!

gufengzhou commented 7 months ago

Sorry for the late reply. Can you pls check this thread and retry?