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

Error in colSums(subset(dt_inputRollWind, select = paid_media_spends), : 'x' must be numeric #859

Open LMiddles opened 7 months ago

LMiddles commented 7 months ago

Project Robyn

Describe issue

Error in colSums(subset(dt_inputRollWind, select = paid_media_spends), : 'x' must be numeric

Provide reproducible example

InputCollect <- robyn_inputs( dt_input = dataset2, dt_holidays = dt_prophet_holidays, date_var = "date", # date format must be "2020-01-01" dep_var = "Revenue", # there should be only one dependent variable dep_var_type = "revenue", # "revenue" (ROI) or "conversion" (CPA) prophet_vars = c("trend", "season","weekday", "holiday"), # "trend","season", "weekday" & "holiday" prophet_country = "UK", # input country code. Check: dt_prophet_holidays context_vars = c("Clinics", "Temp", "Covid_r_level", "Inflation"), # e.g. competitors, discount, unemployment etc paid_media_spends = c("PPC_google_spend", "PPC_bing_spend" ,"PS_spend", "Display_spend", "TV_sky_spend", "TV_ITV_spend", "Radio_spend"), # mandatory input paid_media_vars = c("PPC_google_impressions", "PPC_bing_impressions", "PS_Impressions", "Display_Impressions", "TV_sky_spend", "TV_ITV_spend", "Radio_spend"), # mandatory.

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 = "Organic_impressions", # marketing activity without media spend

factor_vars = c("events"), # force variables in context_vars or organic_vars to be categorical

window_start = "2022-03-01", window_end = "2023-09-01", adstock = "weibull_pdf" # geometric, weibull_cdf or weibull_pdf. )

hyperparameters <- list( PPC_google_spend_alphas = c(0.5, 3), PPC_google_spend_gammas = c(0.3, 1), PPC_google_spend_shapes = c(0, 2), PPC_google_spend_scales = c(0, 0.1),

PPC_bing_spend_alphas = c(0.5, 3), PPC_bing_spend_gammas = c(0.3, 1), PPC_bing_spend_shapes = c(0, 2), PPC_bing_spend_scales = c(0, 0.1),

PS_spend_alphas = c(0.5, 3), PS_spend_gammas = c(0.3, 1), PS_spend_shapes = c(0, 2), PS_spend_scales = c(0, 0.1),

Display_spend_alphas = c(0.5, 3), Display_spend_gammas = c(0.3, 1), Display_spend_shapes = c(0, 2), Display_spend_scales = c(0, 0.1),

TV_sky_spend_alphas = c(0.5, 3), TV_sky_spend_gammas = c(0.3, 1), TV_sky_spend_shapes = c(0, 5), TV_sky_spend_scales = c(0, 0.1),

TV_ITV_spend_alphas = c(0.5, 3), TV_ITV_spend_gammas = c(0.3, 1), TV_ITV_spend_shapes = c(0, 5), TV_ITV_spend_scales = c(0, 0.1),

Radio_spend_alphas = c(0.5, 3), Radio_spend_gammas = c(0.3, 1), Radio_spend_shapes = c(0, 5), Radio_spend_scales = c(0, 0.1),

Organic_impressions_alphas = c(0.5, 3), Organic_impressions_gammas = c(0.3, 1), Organic_impressions_shapes = c(0, 5), Organic_impressions_scales = c(0, 0.1),

train_size = c(0.7, 0.8) )

InputCollect <- robyn_inputs(InputCollect = InputCollect, hyperparameters = hyperparameters)

Running feature engineering... Error in colSums(subset(dt_inputRollWind, select = paid_media_spends), : 'x' must be numeric

Environment & Robyn version

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

gufengzhou commented 7 months ago

do you have NA/NULL etc in paid_media_spends columns? Are these cols numeric?