@@ -99,8 +99,8 @@ InputCollect <- robyn_inputs(
9999 # impressions, GRP etc. If not applicable, use spend instead.
100100 organic_vars = c(" newsletter" ), # marketing activity without media spend
101101 factor_vars = c(" events" ), # specify which variables in context_vars or organic_vars are factorial
102- window_start = " 2016-11-23 " ,
103- window_end = " 2018-08-22 " ,
102+ window_start = " 2016-11-21 " ,
103+ window_end = " 2018-08-20 " ,
104104 adstock = " geometric" # geometric, weibull_cdf or weibull_pdf.
105105)
106106print(InputCollect )
@@ -326,9 +326,9 @@ print(OutputCollect)
326326
327327# # Compare all model one-pagers and select one that mostly reflects your business reality
328328print(OutputCollect )
329- select_model <- " 1_123_3 " # select one from above
329+ select_model <- " 1_100_6 " # Pick one of the models from OutputCollect to proceed
330330
331- # ### Since 3.7.1: JSON export and import (faster and lighter)
331+ # ### Since 3.7.1: JSON export and import (faster and lighter than RDS files )
332332ExportedModel <- robyn_write(InputCollect , OutputCollect , select_model )
333333print(ExportedModel )
334334
@@ -431,7 +431,7 @@ if (TRUE) {
431431
432432# Provide JSON file with your InputCollect and ExportedModel specifications
433433# It can be any model, initial or a refresh model
434- json_file <- " ~/Desktop/Robyn_202208100934_init /RobynModel-1_47_11 .json"
434+ json_file <- " ~/Desktop/Robyn_202208231837_init /RobynModel-1_100_6 .json"
435435RobynRefresh <- robyn_refresh(
436436 json_file = json_file ,
437437 dt_input = dt_simulated_weekly ,
@@ -441,16 +441,20 @@ RobynRefresh <- robyn_refresh(
441441 refresh_trials = 1
442442)
443443
444- json_file_rf1 <- " ~/Desktop/Robyn_202208121601_init/Robyn_202208121604_rf /RobynModel-1_1_1 .json"
444+ json_file_rf1 <- " ~/Desktop/Robyn_202208231837_init/Robyn_202208231841_rf1 /RobynModel-1_12_5 .json"
445445RobynRefresh <- robyn_refresh(
446446 json_file = json_file_rf1 ,
447447 dt_input = dt_simulated_weekly ,
448448 dt_holidays = dt_prophet_holidays ,
449- refresh_steps = 4 ,
449+ refresh_steps = 7 ,
450450 refresh_iters = 1000 , # 1k is estimation. Use refresh_mode = "manual" to try out.
451451 refresh_trials = 1
452452)
453453
454+ # InputCollect <- RobynRefresh$listRefresh1$InputCollect
455+ # OutputCollect <- RobynRefresh$listRefresh1$OutputCollect
456+ # select_model <- RobynRefresh$listRefresh1$OutputCollect$selectID
457+
454458# ##### DEPRECATED (<3.7.1) (might work)
455459# # Run ?robyn_refresh to check parameter definition
456460# Robyn <- robyn_refresh(
@@ -513,6 +517,15 @@ Response1 <- robyn_response(
513517Response1 $ response / Spend1 # ROI for search 80k
514518Response1 $ plot
515519
520+ # ### Or you can call a JSON file directly (a bit slower)
521+ # Response1 <- robyn_response(
522+ # json_file = json_file,
523+ # dt_input = dt_simulated_weekly,
524+ # dt_holidays = dt_prophet_holidays,
525+ # media_metric = "search_S",
526+ # metric_value = Spend1
527+ # )
528+
516529# Get response for +10%
517530Spend2 <- Spend1 * 1.1
518531Response2 <- robyn_response(
@@ -571,7 +584,7 @@ robyn_write(InputCollect, OutputCollect, select_model)
571584# ########### READ ############
572585# Recreate `InputCollect` and `OutputCollect` objects
573586# Pick any exported model (initial or refreshed)
574- json_file <- " ~/Desktop/Robyn_202208081321_init /RobynModel-1_6_1 .json"
587+ json_file <- " ~/Desktop/Robyn_202208231837_init /RobynModel-1_100_6 .json"
575588
576589# Optional: Manually read and check data stored in file
577590json_data <- robyn_read(json_file )
@@ -592,16 +605,18 @@ OutputCollectX <- robyn_run(
592605# Or re-create both by simply using robyn_recreate()
593606RobynRecreated <- robyn_recreate(
594607 json_file = json_file ,
595- dt_input = dt_input ,
596- dt_holidays = dt_holidays ,
608+ dt_input = dt_simulated_weekly ,
609+ dt_holidays = dt_prophet_holidays ,
597610 quiet = FALSE )
611+ InputCollectX <- RobynRecreated $ InputCollect
612+ OutputCollectX <- RobynRecreated $ OutputCollect
598613
599614# Re-export model and check summary (will get exported in your current working directory)
600615myModel <- robyn_write(InputCollectX , OutputCollectX , dir = " ~/Desktop" )
601616print(myModel )
602617
603618# Re-create one-pager
604- myModelPlot <- robyn_onepagers(InputCollectX , OutputCollectX )
619+ myModelPlot <- robyn_onepagers(InputCollectX , OutputCollectX , export = FALSE )
605620myModelPlot
606621
607622# Refresh any imported model
0 commit comments