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

The quick start for MMM does not work #357

Closed
HananInfiniGrow opened this issue Aug 17, 2023 · 6 comments
Closed

The quick start for MMM does not work #357

HananInfiniGrow opened this issue Aug 17, 2023 · 6 comments
Assignees
Labels
bug Something isn't working docs Improvements or additions to documentation good first issue Good for newcomers

Comments

@HananInfiniGrow
Copy link

Running the example code does not work.

import pandas as pd
from pymc_marketing import mmm


data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/datasets/mmm_example.csv"
data = pd.read_csv(data_url, parse_dates=['date_week'])

model = mmm.DelayedSaturatedMMM(
    data=data,
    target_column="y",
    date_column="date_week",
    channel_columns=["x1", "x2"],
    control_columns=[
        "event_1",
        "event_2",
        "t",
        "sin_order_1",
        "cos_order_1",
        "sin_order_2",
        "cos_order_2",
    ],
    adstock_max_lag=8,
)

model.fit()
model.plot_components_contributions();

produces the error:


TypeError Traceback (most recent call last)
Cell In[79], line 25
6 data = pd.read_csv(data_url, parse_dates=['date_week'])
8 model = mmm.DelayedSaturatedMMM(
9 data=data,
10 target_column="y",
(...)
22 adstock_max_lag=8,
23 )
---> 25 model.fit()
26 model.plot_components_contributions();

TypeError: ModelBuilder.fit() missing 1 required positional argument: 'X'

@twiecki twiecki added bug Something isn't working docs Improvements or additions to documentation good first issue Good for newcomers labels Aug 17, 2023
@twiecki
Copy link
Contributor

twiecki commented Aug 17, 2023

Thanks for the report @HananInfiniGrow, would you like to submit a fix?

Otherwise, maybe @michaelraczycki can take a look.

@michaelraczycki
Copy link
Contributor

michaelraczycki commented Aug 18, 2023

This looks like versioning issue, as the mmm_example notebook is already updated. Which version you can see in the left top corner? It might be you're looking at legacy documentation, in that case you should use older version of pymc-marketing.
In the official example notebook I can see:
Screenshot 2023-08-18 at 08 27 05

@HananInfiniGrow
Copy link
Author

It is in the latest official docs at https://www.pymc-marketing.io/en/stable/

p.s. thank you for publishing this open source. I know how much of a headache is it to implement this model alone. Please also support hierarchial and budget allocation optimization.

@michaelraczycki
Copy link
Contributor

I'm sorry, I'm afraid I can't help in this case, the link you're providing shows me the doc version I've shared with you on the screenshot above. In general, we've altered the API a bit, to follow sklearn API. So now you need to divide your dataset into the X data frame, and y series (containing the target variable) and pass it along to fit() method. That should solve your problem. As to the example notebook, @ricardoV94 any ideas why we're seeing different documentation versions?

@HananInfiniGrow
Copy link
Author

@ricardoV94
Copy link
Contributor

The documentation was only updated after we released the last version (in #340), and we haven't re-released so it doesn't show it up to date yet.

If you go to latest you can see it already is corrected: https://www.pymc-marketing.io/en/latest/

We should be releasing later today, so everything will be in sync soon enough. Apologies for the confusion @HananInfiniGrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants