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

idata is removed if fit is called

Open wd60622 opened this issue 1 year ago • 4 comments

Example:

import pandas as pd

from pymc_marketing.mmm import DelayedSaturatedMMM

df = pd.read_csv("datasets/mmm_example.csv", parse_dates=["date_week"])
mmm = DelayedSaturatedMMM(
    date_column="date_week",
    channel_columns=["x1", "x2"], 
    adstock_max_lag=12,
)

y = df.pop("y")
mmm.sample_prior_predictive(df, extend_idata=True)
# mmm.idata is completely replaced in the fit method
mmm.fit(df, y)

That replacement seems to happen here: https://github.com/pymc-labs/pymc-marketing/blob/main/pymc_marketing/model_builder.py#L477

wd60622 avatar Dec 07 '23 19:12 wd60622

I started fixing this in https://github.com/pymc-labs/pymc-marketing/pull/414 but didn't take it to the finish line yet

ricardoV94 avatar Dec 07 '23 19:12 ricardoV94

Sounds good. Sorry to reraise

wd60622 avatar Dec 07 '23 19:12 wd60622

@ricardoV94 Does the join kwarg address this?

wd60622 avatar Jan 17 '24 19:01 wd60622

I think we are still overriding any old idata when we call fit, even in #482

ricardoV94 avatar Jan 18 '24 08:01 ricardoV94