MMMPlotSuite.budget_allocation#
- MMMPlotSuite.budget_allocation(*args, **kwargs)[source]#
Create bar chart comparing allocated spend and channel contributions.
Deprecated since version 0.18.0: This method was removed in MMMPlotSuite v2. The arviz_plots library used in v2 doesn’t support this specific chart type. See alternatives below.
- Raises:
NotImplementedErrorThis method is not available in MMMPlotSuite v2.
See also
budget_allocation_roasPlot ROI distributions by channel
Notes
Alternatives:
For ROI distributions: Use
budget_allocation_roas()(different purpose but related to budget allocation)To use the old method: Switch to legacy suite:
from pymc_marketing.mmm import mmm_plot_config mmm_plot_config["plot.use_v2"] = False mmm.plot.budget_allocation(samples)
Custom implementation: Create bar chart using samples data:
import matplotlib.pyplot as plt channel_contrib = samples["channel_contribution"].mean(...) allocated_spend = samples["allocation"] # Create custom bar chart with matplotlib
Examples
Use legacy suite temporarily:
from pymc_marketing.mmm import mmm_plot_config original = mmm_plot_config.get("plot.use_v2") try: mmm_plot_config["plot.use_v2"] = False fig, ax = mmm.plot.budget_allocation(samples) fig.savefig("budget.png") finally: mmm_plot_config["plot.use_v2"] = original