pymc-labs/pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.

What it solves

PyMC-Marketing provides a suite of Bayesian tools for marketing analytics, helping businesses maximize ROI by quantifying the impact of marketing spend and understanding customer behavior. It addresses the challenge of attributing sales to specific channels, predicting customer lifetime value, and analyzing how customers choose between competing products.

How it works

Built on top of PyMC and ArviZ, the library implements several advanced Bayesian modeling techniques:

  • Marketing Mix Modeling (MMM): Uses Bayesian inference to estimate the effect of various media channels on sales, incorporating adstock (carry-over effects) and saturation (diminishing returns).
  • Customer Lifetime Value (CLV): Employs models like BG/NBD and Pareto/NBD to predict future purchase frequency and customer churn in both contractual and non-contractual settings.
  • Customer Choice: Uses Multivariate Interrupted Time Series (MVITS) for product launch impact, and discrete choice models (like Multinomial and Nested Logit) to estimate the utility of product features.
  • Incrementality: Integrates Predicted Incrementality by Experimentation (PIE) and lift test calibration to refine model accuracy based on empirical data.

Who it’s for

This tool is designed for data scientists, marketing analysts, and businesses that need to move beyond simple attribution models to data-driven budget allocation and customer value prediction.

Highlights

  • Advanced MMM Features: Supports time-varying intercepts, time-varying media contributions, and causal identification via directed acyclic graphs (DAGs).
  • Budget Optimization: Includes tools to allocate marketing spend efficiently across channels for maximum ROI.
  • Flexible Inference: Compatible with multiple NUTS samplers (BlackJax, NumPyro, Nutpie) and supports GPU acceleration.
  • Comprehensive Choice Analysis: Offers tools for structural demand estimation (Bayesian BLP) and MaxDiff scaling.
  • Funnel Modeling: Can model the mediation between upper-funnel awareness and lower-funnel conversions.

Related

  • Project
  • Project
  • Project
  • Project
  • Project