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

Execution halted when running robyn_refresh #857

Closed dataroby closed 7 months ago

dataroby commented 7 months ago

Project Robyn

Describe issue

When I run robyn_refresh I get the following error:

Error: object 'InputCollect' not found Execution halted

Here's my code:

Install, load, and check (latest) Robyn version, using one of these 2 sources:

A) Install the latest stable version from CRAN:

install.packages("Robyn")

B) Install the latest dev version from GitHub:

install.packages("remotes") # Install remotes first if you haven't already remotes::install_github("facebookexperimental/Robyn/R")

library(Robyn) library(readr)

setwd("/home/media_user/Documents/Edenred") json_file <- "/home/xxx/RobynModel-5_279_2.json"

data("dt_prophet_holidays")

mmm_input <- read_csv("mmm_input2.csv", col_types = cols(DATE = col_date(format = "%d/%m/%Y")))

mmm_input$Webinar_S[is.na(mmm_input$Webinar_S)] <-- 0

################################################################

Optional: recreate old models and replicate results

From an exported JSON file (which is created automatically when exporting a model)

we can re-create a previously trained model and outputs. Note: we need to provide

the main dataset and the holidays dataset, which are NOT stored in the JSON file.

These JSON files will be automatically created in most cases.

############ WRITE ############

Manually create JSON file with inputs data only

robyn_write(InputCollect, dir = "/home/xxx")

select_model <- "5_279_2"

Manually create JSON file with inputs and specific model results

robyn_write(InputCollect, OutputCollect, select_model)

RobynRefresh <- robyn_refresh( json_file = json_file, dt_input = mmm_input,#InputCollectX$dt_input, dt_holidays = dt_prophet_holidays,#InputCollectX$dt_holidays, refresh_steps = 6, refresh_mode = "manual", refresh_iters = 1000, refresh_trials = 1 )

Thanks for your help in advance!

gufengzhou commented 7 months ago

sorry for the late reply. please follow the steps from here. If you have the json file, no need to do robyn_write again.