MMMPlotlyFactory.adstock_curves#
- MMMPlotlyFactory.adstock_curves(hdi_prob=None, hdi_opacity=0.2, amount=1.0, num_samples=500, random_state=None, auto_facet=True, single_dim_facet='col', **plotly_kwargs)[source]#
Plot adstock/decay curves by channel.
Creates an interactive Plotly line chart showing adstock decay curves for each channel, with optional HDI uncertainty bands and faceting for multi-dimensional models.
- Parameters:
- hdi_prob
floatorNone, optional HDI probability for uncertainty bands. If None (default), no bands.
- hdi_opacity
float, default 0.2 Opacity for HDI band fill (0-1).
- amount
float, default 1.0 Impulse amount at time 0
- num_samples
intorNone, optional Number of posterior samples to use for generating curves. By default 500. Using fewer samples speeds up computation and reduces memory usage while still capturing posterior uncertainty. If None, all posterior samples are used without subsampling.
- random_state
int,np.random.Generator, orNone, optional Random state for reproducible subsampling. Can be an integer seed, a numpy Generator instance, or None for non-reproducible sampling. Only used when num_samples is not None and less than total available samples.
- auto_facetbool, default
True Automatically detect and apply faceting for custom dimensions.
- single_dim_facet{“col”, “row”}, default “col”
When auto_facet is enabled and there is exactly one custom dimension, this controls whether it is applied as facet_col or facet_row.
- **plotly_kwargs
Additional Plotly Express arguments including: - title: Figure title (default: “Adstock Curves”) - facet_row: Column for row facets - facet_col: Column for column facets - facet_col_wrap: Max columns before wrapping
- hdi_prob
- Returns:
go.FigureInteractive Plotly figure
Examples
>>> # Basic adstock curves >>> fig = mmm.plot_interactive.adstock_curves() >>> fig.show()
>>> # With faceting by country >>> fig = mmm.plot_interactive.adstock_curves(facet_col="country") >>> fig.show()
>>> # Custom impulse amount >>> fig = mmm.plot_interactive.adstock_curves(amount=100.0) >>> fig.show()