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.16k stars 346 forks source link

Getting error(dict_keys(['error'])) while using Python api #1085

Open Sanchit-emeritus opened 1 month ago

Sanchit-emeritus commented 1 month ago

Project Robyn

Describe issue

I am using Robyn api from Python and while running the below code after setting the arguments for hyperparameters it is giving dict_keys(['error']) This is the code I am trying to run :

# Get response
InputCollect = robyn_api('robyn_inputs',payload=payload)
InputCollect.keys()

Please let me know how to resolve this error. It would be a great help. Thanks in advance.

Provide reproducible example

This is how i setup my input variables for robyn_inputs :

inputArgs = {
    "date_var": "date", # date format must be "2020-01-01"

    "dep_var": "total_paid_apps", # there should be only one dependent variable

    "dep_var_type": "conversion", # "revenue" (ROI) or "conversion" (CPA)

    "prophet_vars": ["trend", "season", "weekday", "holiday"], # "trend","season", "weekday" & "holiday"

    "prophet_country": "US", # input country code. Check: dt_prophet_holidays

    "context_vars" : ["mdr_dummy"],

    "paid_media_spends": ["total_spend_social", "total_spend_sem_brand", "total_spend_sem_nonbrand", "total_spend_linkedin", "total_spend_sem_others", "total_spend_other_paid"], # mandatory input

    # "paid_media_vars": ["total_impressions_social", "total_clicks_social", "total_leads_social", "total_apps_social", 
    #                     "total_impressions_sem_brand", "total_clicks_sem_brand",  "total_leads_sem_brand", "total_apps_sem_brand", 
    #                     "total_impressions_sem_nonbrand", "total_clicks_sem_nonbrand", "total_leads_sem_nonbrand", "total_apps_sem_nonbrand", 
    #                     "total_impressions_linkedin", "total_clicks_linkedin", "total_leads_linkedin", "total_apps_linkedin", 
    #                     "total_impressions_sem_others", "total_clicks_sem_others", "total_leads_sem_others", "total_apps_sem_others", 
    #                     "total_impressions_affiliate", "total_clicks_affiliate", "total_leads_affiliate", "total_apps_affiliate", 
    #                     "total_impressions_other_paid", "total_clicks_other_paid", "total_leads_other_paid", "total_apps_other_paid"], # mandatory.

    "paid_media_vars": ["total_clicks_social", "total_clicks_sem_brand", "total_clicks_sem_nonbrand", "total_clicks_linkedin", "total_clicks_sem_others", "total_clicks_other_paid"], 

    # paid_media_vars must have same order as paid_media_spends. Use media exposure metrics like
    # impressions, GRP etc. If not applicable, use spend instead.

    # "organic_vars" : ["total_leads_referral", "total_apps_referral", 
    #                   "total_leads_organic", "total_apps_organic"],  # marketing activity without media spend

    "factor_vars" : ["mdr_dummy"], # force variables in context_vars or organic_vars to be categorical

    "window_start": "2021-12-09",

    "window_end": "2024-08-28",

    "adstock": "weibull_pdf" # geometric, weibull_cdf or weibull_pdf.
}

Also wanted to ask If i want to provide impressions, clicks, leads, etc in paid_media_vars for each marketing channel defined in paid_media_spend, how can i do it? As of now I am using only one variable for each marketing spend, i.e. number of clicks. But if you see the commented paid_media_vars in my code above, there I have tried to put multiple variables like impressions, clicks, leads, etc. is it the correct way to pass multiple variables for each marketing channel in paid_media_vars ?

Environment & Robyn version

Using ['3.11.1.9003'] version of Robyn