Skip to content

Discrepancies in variable parameters during Robyn model recreation #1312

@TingSun298

Description

@TingSun298

Hi Robyn team,

I am attempting to recreate a model that I previously saved using robyn_write, but I'm encountering an issue where the variable parameters don’t match the original ones. Both the saving and recreating processes are executed in the same environment with Robyn package version 3.11.1. Below are the code snippets I used:

Save Model

ExportedModel <- robyn_write(InputCollect, OutputCollect, select_model, export = TRUE)
print(ExportedModel)

Recreate Model

# Read original JSON
original_json <- robyn_read(json_file, quiet = TRUE)

# Recreate model
recreated_result <- robyn_recreate(json_file)

# Compare key coefficients
original_coefs <- original_json$ExportedModel$summary$coef
recreated_coefs <- recreated_result$OutputCollect$DecompAggs$coef

# Check differences
max_diff <- max(abs(original_coefs - recreated_coefs), na.rm = TRUE)
cat("Maximum coefficient difference: ", max_diff, "\n")

if (max_diff < 1e-10) {
  cat("✅ Recreation successful! Coefficients are identical.\n")
} else {
  cat("❌ Recreation failed. There are differences in coefficients.\n")
}

When recreating, the output shows:

>>> Recreating 3_382_3

Imported JSON file successfully: /mnt/workspace/AprilSun/MMM /output/tmall_brand_zone/Robyn_202510171133_init/RobynModel-3_382_3.json

>> Running feature engineering...

Warning message in prophet_decomp(dt_transform, dt_holidays = InputCollect$dt_holidays, :
“Currently, there's a known issue with prophet that may crash this use case.
 Read more here: [https://github.com/facebookexperimental/Robyn/issues/472”](https://github.com/facebookexperimental/Robyn/issues/472%E2%80%9D)
Input data has 1096 days in total: 2022-09-01 to 2025-08-31

Initial model is built on rolling window of 1096 day: 2022-09-01 to 2025-08-31

>>> Calculating response curves for all models' media variables (3)...

Successfully recreated model ID: 3_382_3

最大系数差异: 63537.45 
❌ 重现失败,系数存在差异

I would appreciate any guidance on why the variable parameters aren’t matching and how to resolve this discrepancy. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions