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

Unable to change 'method' for DelayedSaturatedMMM.plot_direct_contribution_curves() on pymc-marketing version 0.7.0 #804

Closed
ezjsiwu opened this issue Jul 3, 2024 · 5 comments
Labels

Comments

@ezjsiwu
Copy link

ezjsiwu commented Jul 3, 2024

Hi there I'm rebuilding my MMM in pymc-marketing version 0.7.0 due to the newly available saturation and adstock capabilities. However, when I tried using the DelayedSaturatedMMM.plot_direct_contribution_curves() it gave me an error when I want to choose the method to 'michaelis-menten'..
Screenshot 2024-07-03 at 2 45 27 PM

@wd60622 wd60622 added the MMM label Jul 3, 2024
@wd60622
Copy link
Contributor

wd60622 commented Jul 3, 2024

Hi there I'm rebuilding my MMM in pymc-marketing version 0.7.0 due to the newly available saturation and adstock capabilities. However, when I tried using the DelayedSaturatedMMM.plot_direct_contribution_curves() it gave me an error when I want to choose the method to 'michaelis-menten'..

Screenshot 2024-07-03 at 2 45 27 PM

Are you calling the method on the class itself? Or on an instance of the class?

Can you show the code you run leading up to this error message 🙏

@ezjsiwu
Copy link
Author

ezjsiwu commented Jul 3, 2024

hi Will, thanks for your response.. i'm calling on the method on the class itself..
Here's the code for my model config..

mmm = MMM(
    model_config = my_model_config,
    sampler_config = sampler_config,
    date_column="week",
    channel_columns=spend_cols,
    control_columns=control_cols,
    adstock="geometric", 
    saturation="logistic",
    adstock_max_lag=10,
    yearly_seasonality=10
)

mmm.build_model(X_train, y_train)


df_lift_test = pd.DataFrame.from_dict({
        "channel": ['spend_youtube','spend_linkedin','spend_facebook'],
        "x": [75900,48863.60,80000],
        "delta_x": [91000,10433,12000],
        "delta_y": [300,857,50],
        "sigma": [72,102,18]
    })

mmm.add_lift_test_measurements(df_lift_test)

mmm.fit(X=X_train, y=y_train, target_accept=0.90, chains=4, draws=1000, random_seed=123)

mmm.sample_posterior_predictive(X_train, extend_idata=True, combined=True)

Model was fitted fine and had acceptable results.. I just wasn't able to use the plot_direct_contribution_curve using method.. I ran this same exact code in version 0.6.0 and it worked fine..
mmm.plot_direct_contribution_curves(show_fit=True, method='sigmoid',xlim_max=3,same_axes=False)

@wd60622
Copy link
Contributor

wd60622 commented Jul 3, 2024

Model was fitted fine and had acceptable results.. I just wasn't able to use the plot_direct_contribution_curve using method.. I ran this same exact code in version 0.6.0 and it worked fine..

mmm.plot_direct_contribution_curves(show_fit=True, method='sigmoid',xlim_max=3,same_axes=False)

Try it without the method keyword then. It seems to have been dropped as the fit curve will come from saturation specified at initialization.

@juanitorduz shall we go in an a deprecation? Was this a keyword arg up until this release?

@juanitorduz
Copy link
Collaborator

Yes we can do this!

@ezjsiwu
Copy link
Author

ezjsiwu commented Jul 4, 2024

That works! Thanks @wd60622 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants