back to home

pymc-labs / pymc-marketing

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

1,089 stars
370 forks
416 issues
PythonMakefileDockerfile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing pymc-labs/pymc-marketing in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/pymc-labs/pymc-marketing)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

---- PyMC-Marketing Bayesian Tools for Marketing Analytics: Marketing Mix Modeling (MMM), Customer Lifetime Value (CLV) & Customer Choice Analysis (CSA) and more --- Marketing Analytics Tools from PyMC Labs Unlock the power of **Marketing Mix Modeling (MMM)**, **Customer Lifetime Value (CLV)** and **Customer Choice Analysis (CSA)** analytics with PyMC-Marketing. This open-source marketing analytics tool empowers businesses to make smarter, data-driven decisions for maximizing ROI in marketing campaigns. This repository is supported by PyMC Labs. For businesses looking to integrate PyMC-Marketing into their operational framework, PyMC Labs offers expert consulting and training. Our team is proficient in state-of-the-art Bayesian modeling techniques, with a focus on Marketing Mix Models (MMMs) and Customer Lifetime Value (CLV). For more information see here. Explore these topics further by watching our video on Bayesian Marketing Mix Models: State of the Art. Community Resources • PyMC-Marketing Discussions • PyMC Discourse • Bayesian Discord server • MMM Hub Slack Quick Installation Guide To dive into PyMC-Marketing, set up a specialized Python environment, , via conda-forge: For a comprehensive installation guide, refer to the official PyMC installation documentation. Docker We provide a to build a Docker image for PyMC-Marketing so that is accessible from a Jupyter Notebook. See here for more details. In-depth Bayesian Marketing Mix Modeling (MMM) in PyMC Leverage our Bayesian MMM API to tailor your marketing strategies effectively. Leveraging on top of the research article Jin, Yuxue, et al. “Bayesian methods for media mix modeling with carryover and shape effects.” (2017), and extending it by integrating the expertise from core PyMC developers, our API provides: | Feature | Benefit | | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Custom Priors and Likelihoods | Tailor your model to your specific business needs by including domain knowledge via prior distributions. | | Adstock Transformation | Optimize the carry-over effects in your marketing channels. | | Saturation Effects | Understand the diminishing returns in media investments. | | Customize adstock and saturation functions | You can select from a variety of adstock and saturation functions. You can even implement your own custom functions. See documentation guide. | | Time-varying Intercept | Capture time-varying baseline contributions in your model (using modern and efficient Gaussian processes approximation methods). See guide notebook. | | Time-varying Media Contribution | Capture time-varying media efficiency in your model (using modern and efficient Gaussian processes approximation methods). See the guide notebook. | | Visualization and Model Diagnostics | Get a comprehensive view of your model's performance and insights. | | Causal Identification | Input a business driven directed acyclic graph to identify the meaningful variables to include into the model to be able to draw causal conclusions. For a concrete example see the guide notebook. | | Choose among many inference algorithms | We provide the option to choose between various NUTS samplers (e.g. BlackJax, NumPyro and Nutpie). See the example notebook for more details. | | GPU Support | PyMC's multiple backends allow for GPU acceleration. | | Out-of-sample Predictions | Forecast future marketing performance with credible intervals. Use this for simulations and scenario planning. | | Budget Optimization | Allocate your marketing spend efficiently across various channels for maximum ROI. See the budget optimization example notebook | | Experiment Calibration | Fine-tune your model based on empirical experiments for a more unified view of marketing. See the lift test integration explanation for more details. Here you can find a *Case Study: Unobserved Confounders, ROAS and Lift Tests*. | MMM Quickstart The following snippet of code shows how to initiate and fit a model. After the model is fitted, we can explore the reults and insights. For example, we can plot the components contributions: You can compute channels efficienty and compare them with the estimated return on ad spend (ROAS). Once the model is fitted, we can further optimize our budget allocation as we are including diminishing returns and carry-over effects in our model. • Explore a hands-on our quickstart guide and more complete simulated example for more insights into MMM with PyMC-Marketing. • Get started with a complete end-to-end analysis: from model specification to budget allocation. See the guide notebook. Essential Reading for Marketing Mix Modeling (MMM) • Bayesian Media Mix Modeling for Marketing Optimization • Improving the Speed and Accuracy of Bayesian Marketing Mix Models • Johns, Michael and Wang, Zhenyu. "A Bayesian Approach to Media Mix Modeling" • Orduz, Juan. "Media Effect Estimation with PyMC: Adstock, Saturation & Diminishing Returns" • A Comprehensive Guide to Bayesian Marketing Mix Modeling Explainer App: Streamlit App of MMM Concepts Dynamic and interactive visualization of key Marketing Mix Modeling (MMM) concepts, including adstock, saturation, and the use of Bayesian priors. This app aims to help marketers, data scientists, and anyone interested in understanding MMM more deeply. **Check out the app here** Unlock Customer Lifetime Value (CLV) with PyMC Understand and optimize your customer's value with our **CLV models**. Our API supports various types of CLV models, catering to both contractual and non-contractual settings, as well as continuous and discrete transaction modes. • CLV…