pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
717 stars 202 forks source link

Support channel per axes in `plot_channel_contribution_grid` #818

Open ezjsiwu opened 4 months ago

ezjsiwu commented 4 months ago

Hi there, is it possible to plot each channel contribution in different subplots for the mmm.plot_channel_contribution_grid() ?

https://www.pymc-marketing.io/en/latest/api/generated/pymc_marketing.mmm.delayed_saturated_mmm.DelayedSaturatedMMM.plot_channel_contributions_grid.html

wd60622 commented 4 months ago

Hi @ezjsiwu

It is not built in functionality even though the plt_kwargs can be passed. ncols or nrows would cause an error. Maybe you'd like to make a PR to add this functionality in?

Also, the data using in the plot is created with the get_channel_contributributions_forward_pass_grid

start = 0
stop = 10
num = 12
contributions: xr.DataArray = mmm.get_channel_contributions_forward_pass_grid(
    start=start, stop=stop, num=num
)

From there, you can create any plot you would like

ezjsiwu commented 4 months ago

hey @wd60622 ! thanks for the response.. I was able to create the plots just by extracting the get_channel_contributions_forward_pass_grid() function.. How can i submit a PR on this?

wd60622 commented 4 months ago

Hi @ezjsiwu Thank you for your interest in contributing! Juan recommends this resource for getting started: https://www.sktime.net/en/stable/developer_guide/git_workflow.html if you are new to open source.

We have some steps for getting started with pymc-marketing here: https://github.com/pymc-labs/pymc-marketing/blob/main/CONTRIBUTING.md Beware, we are aware that some steps might be stale.

From your forked pymc-marketing repo's branch, make a PR into pymc-labs/pymc-marketing main branch. The earlier the PR is opened, the better. We are here to help out!

wd60622 commented 2 weeks ago

Hi @ezjsiwu Are you still interested in taking this issue?