MMMPlotSuite.uplift_curve#
- MMMPlotSuite.uplift_curve(hdi_prob=0.94, ax=None, aggregation=None, subplot_kwargs=None, *, plot_kwargs=None, ylabel='Uplift', xlabel='Sweep', title='Uplift curve', add_figure_title=True)[source]#
Plot precomputed uplift curves stored under
idata.sensitivity_analysis['uplift_curve'].- Parameters:
- hdi_prob
float, default 0.94 HDI probability mass.
- ax
plt.Axes, optional The axis to plot on.
- aggregation
dict, optional Aggregation to apply to the data. E.g., {“sum”: (“channel”,)} to sum over the channel dimension.
- subplot_kwargs
dict, optional Additional subplot configuration forwarded to
sensitivity_analysis().- plot_kwargs
dict, optional Keyword arguments forwarded to the underlying line plot. If not provided, defaults are used by
sensitivity_analysis()(e.g., color “C0”).- ylabel
str, optional Y-axis label. Defaults to “Uplift”.
- xlabel
str, optional X-axis label. Defaults to “Sweep”.
- title
str, optional Figure-level title to add when
add_figure_title=True. Defaults to “Uplift curve”.- add_figure_titlebool, optional
Whether to add a figure-level title. Defaults to
True.
- hdi_prob
Examples
Persist uplift curve and plot:
from pymc_marketing.mmm.sensitivity_analysis import SensitivityAnalysis sweeps = np.linspace(0.5, 1.5, 11) sa = SensitivityAnalysis(mmm.model, mmm.idata) results = sa.run_sweep( var_input="channel_data", sweep_values=sweeps, var_names="channel_contribution", sweep_type="multiplicative", ) uplift = sa.compute_uplift_curve_respect_to_base( results, ref=1.0, extend_idata=True ) _ = mmm.plot.uplift_curve(hdi_prob=0.9)