taste_profiles#

Post-hoc taste-profile analysis for fitted BayesianBLP models.

This module exposes the lenses the demo notebooks use to characterise who buys in each market, given the posterior over preference parameters and the Halton grid of consumer types attached to the model:

Plus four convenience plotters that wrap each computation in a standard matplotlib figure with layout="constrained" so colorbar layouts compose cleanly with the rest of pymc-marketing’s notebook style.

All public functions take a fitted BayesianBLP model and raise RuntimeError when the model has no posterior. The single internal helper _compute_inside_choice_probs() is the only place that reaches into the model’s private API; all public functions delegate through it.

Functions

brand_buyer_nu(model[, n_samples, dim])

Posterior-mean buyer taste per brand and market, for one taste dimension.

buyer_nu_posterior(model[, n_samples])

Posterior of the average buyer's taste vector per market.

consumer_taste_grid(model)

Halton grid as a labelled DataFrame.

demand_concentration_gini(model[, n_samples])

Per-sample Gini of inside-good demand across consumer types, per market.

plot_brand_buyer_heatmap(model[, n_samples, ...])

(market × brand) diverging heatmap of brand-level buyer taste.

plot_buyer_profile_heatmap(model[, ...])

(market × dimension) diverging heatmap of the average buyer's taste vector.

plot_demand_concentration(model[, n_samples, ax])

Gini coefficient of inside-good demand vs. average market price.

plot_taste_profile_stacked(model[, ...])

Stacked area chart of consumer allocation across the \(\nu_{\mathrm{price}}\) axis.

taste_type_demand_share(model[, n_samples, ...])

Share of inside-good demand contributed by each price-taste bucket.