Marketing Analytics Tools from PyMC Labs
Unlock the power of Marketing Mix Modeling (MMM) and Customer Lifetime Value (CLV) 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.
To dive into MMM and CLV analytics, set up a specialized Python environment, marketing_env
, via conda-forge:
conda create -c conda-forge -n marketing_env pymc-marketing
conda activate marketing_env
For a comprehensive installation guide, refer to the official PyMC installation documentation.
We provide a Dockerfile
to build a Docker image for PyMC-Marketing so that is accessible from a Jupyter Notebook. See here for more details.
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 | Description |
---|---|
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. |
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. |
import pandas as pd
from pymc_marketing.mmm import (
GeometricAdstock,
LogisticSaturation,
MMM,
)
data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/mmm_example.csv"
data = pd.read_csv(data_url, parse_dates=["date_week"])
mmm = MMM(
adstock=GeometricAdstock(l_max=8),
saturation=LogisticSaturation(),
date_column="date_week",
channel_columns=["x1", "x2"],
control_columns=[
"event_1",
"event_2",
"t",
],
yearly_seasonality=2,
)
Initiate fitting and get a visualization of some of the outputs with:
X = data.drop("y",axis=1)
y = data["y"]
mmm.fit(X,y)
mmm.plot_components_contributions();
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 simulated example for more insights into MMM with PyMC-Marketing.
- 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
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.
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.
Explore our detailed CLV examples using data from the lifetimes
package:
Non-contractual | Contractual | |
---|---|---|
Continuous | online purchases | ad conversion time |
Discrete | concerts & sports events | recurring subscriptions |
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pymc_marketing import clv
data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/clv_quickstart.csv"
data = pd.read_csv(data_url)
data["customer_id"] = data.index
beta_geo_model = clv.BetaGeoModel(data=data)
beta_geo_model.fit()
Once fitted, we can use the model to predict the number of future purchases for known customers, the probability that they are still alive, and get various visualizations plotted.
See the Examples section for more on this.
PyMC-Marketing is and will always be free for commercial use, licensed under Apache 2.0. Developed by core developers behind the popular PyMC package and marketing experts, it provides state-of-the-art measurements and analytics for marketing teams.
Due to its open-source nature and active contributor base, new features are constantly added. Are you missing a feature or want to contribute? Fork our repository and submit a pull request. If you have any questions, feel free to open an issue.
Not sure how to start or have questions? MMM-GPT is an AI that answers questions and provides expert advice on marketing analytics using PyMC-Marketing.
Maximize your marketing ROI with a free 30-minute strategy session with our PyMC-Marketing experts. Learn how Bayesian Marketing Mix Modeling and Customer Lifetime Value analytics can boost your organization by making smarter, data-driven decisions.
We provide the following professional services:
- Custom Models: We tailor niche marketing analytics models to fit your organization's unique needs.
- Build Within PyMC-Marketing: Our team members are experts leveraging the capabilities of PyMC-Marketing to create robust marketing models for precise insights.
- SLA & Coaching: Get guaranteed support levels and personalized coaching to ensure your team is well-equipped and confident in using our tools and approaches.
- SaaS Solutions: Harness the power of our state-of-the-art software solutions to streamline your data-driven marketing initiatives.