pymc-marketing icon indicating copy to clipboard operation
pymc-marketing copied to clipboard

different results from plot_posterior_predictive when run twice

Open Alcampopiano opened this issue 1 year ago • 4 comments

Hello and thanks for the great library.

When I run mmm.sample_posterior_predictive(mmm.preprocessed_data['X'], extend_idata=True, combined=True) followed by mmm.plot_posterior_predictive(original_scale=True);, I get the following plot:

ppc1

Then, if I run the same code again, I get this plot:

ppc2

Is this expected?

I am using v0.3.3

Alcampopiano avatar Jan 16 '24 02:01 Alcampopiano

Can you share your setup code? Are there any fits as well?

wd60622 avatar Jan 16 '24 03:01 wd60622

I'm be happy to! Here are a few of the plots/tables used in the example guide as well as my model config (just uniform priors mostly); however, even when I use more informed priors I find this same effect.

All r_hats are 1.01 or 1.

Please let me know if this helps! Glad to share other metrics.

my_model_config = {
    "intercept": {"dist": "Uniform", "kwargs": {"lower": 0, "upper": 1}},

    "beta_channel": {
        "dist": "Uniform",
        "kwargs": {"lower": 0, "upper": 1},
    },
    "alpha": {"dist": "Uniform", "kwargs": {"lower": 0, "upper": 1}},
    "lam": {"dist": "Uniform", "kwargs": {"lower": 0, "upper": 1}},
    "likelihood": {
        "dist": "Normal",
        "kwargs": {"sigma": {"dist": "HalfNormal", "kwargs": {"sigma": 2}}},
    },
    "gamma_control": {"dist": "Uniform", "kwargs": {"lower": 0, "upper": 1}},
    "gamma_fourier": {"dist": "Uniform", "kwargs": {"lower": 0, "upper": 1}},
}

cat sum

Alcampopiano avatar Jan 16 '24 03:01 Alcampopiano

Hi @Alcampopiano

Was there additional setup prior to calling sample_posterior_predictive? I have not encountered this and the example notebook don't experience this as well.

Would you happen to know if this has been resolved with the later versions?

wd60622 avatar May 19 '24 11:05 wd60622

Hi @wd60622

Thanks very much for checking in.

Unfortunately, I dont have that project anymore—otherwise I'd be happy to try and reproduce.

I suspect that newer versions of pymc-marketing are not affected as you mention but cannot confirm as I switched to using pymc.

Thanks for all the great work!

Alcampopiano avatar May 19 '24 12:05 Alcampopiano