Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idata is removed if fit is called #459

Closed
wd60622 opened this issue Dec 7, 2023 · 4 comments
Closed

idata is removed if fit is called #459

wd60622 opened this issue Dec 7, 2023 · 4 comments
Labels
bug Something isn't working ModelBuilder Related to the ModelBuilder class and its children

Comments

@wd60622
Copy link
Contributor

wd60622 commented Dec 7, 2023

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 wd60622 changed the title prior removed if fit is called after idata is removed if fit is called Dec 7, 2023
@ricardoV94
Copy link
Contributor

I started fixing this in #414 but didn't take it to the finish line yet

@wd60622
Copy link
Contributor Author

wd60622 commented Dec 7, 2023

Sounds good. Sorry to reraise

@wd60622
Copy link
Contributor Author

wd60622 commented Jan 17, 2024

@ricardoV94
Does the join kwarg address this?

@ricardoV94
Copy link
Contributor

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

@wd60622 wd60622 closed this as completed Jun 12, 2024
@wd60622 wd60622 added ModelBuilder Related to the ModelBuilder class and its children bug Something isn't working labels Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ModelBuilder Related to the ModelBuilder class and its children
Projects
None yet
Development

No branches or pull requests

2 participants