Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

pymc-labs/pymc-marketing

Repository files navigation

PyMC-Marketing Logo


TestTest NotebookcodecovRuffdocs

PyPI VersionLicense

DownloadsDownloadsDownloads

PyMC-Marketing: Bayesian Marketing Mix Modeling (MMM) & Customer Lifetime Value (CLV)

Marketing Analytics Tools fromPyMC Labs

Unlock the power ofMarketing Mix Modeling (MMM),Customer Lifetime Value (CLV) andCustomer 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 byPyMC 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 seehere.

Explore these topics further by watching our video onBayesian Marketing Mix Models: State of the Art.

Community Resources

Quick Installation Guide

To dive into PyMC-Marketing, set up a specialized Python environment,marketing_env, via conda-forge:

conda create -c conda-forge -n marketing_env pymc-marketingconda activate marketing_env

For a comprehensive installation guide, refer to theofficial PyMC installation documentation.

Docker

We provide aDockerfile to build a Docker image for PyMC-Marketing so that is accessible from a Jupyter Notebook. Seehere 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 articleJin, 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:

FeatureBenefit
Custom Priors and LikelihoodsTailor your model to your specific business needs by including domain knowledge via prior distributions.
Adstock TransformationOptimize the carry-over effects in your marketing channels.
Saturation EffectsUnderstand the diminishing returns in media investments.
Customize adstock and saturation functionsYou can select from a variety of adstock and saturation functions. You can even implement your own custom functions. Seedocumentation guide.
Time-varying InterceptCapture time-varying baseline contributions in your model (using modern and efficient Gaussian processes approximation methods). Seeguide notebook.
Time-varying Media ContributionCapture time-varying media efficiency in your model (using modern and efficient Gaussian processes approximation methods). See theguide notebook.
Visualization and Model DiagnosticsGet a comprehensive view of your model's performance and insights.
Causal IdentificationInput 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 theguide notebook.
Choose among many inference algorithmsWe provide the option to choose between various NUTS samplers (e.g. BlackJax, NumPyro and Nutpie). See theexample notebook for more details.
GPU SupportPyMC's multiple backends allow for GPU acceleration.
Out-of-sample PredictionsForecast future marketing performance with credible intervals. Use this for simulations and scenario planning.
Budget OptimizationAllocate your marketing spend efficiently across various channels for maximum ROI. See thebudget optimization example notebook
Experiment CalibrationFine-tune your model based on empirical experiments for a more unified view of marketing. See thelift test integration explanation for more details.Here you can find aCase Study: Unobserved Confounders, ROAS and Lift Tests.

MMM Quickstart

importpandasaspdfrompymc_marketing.mmmimport (GeometricAdstock,LogisticSaturation,MMM,)frompymc_marketing.pathsimportdata_dirfile_path=data_dir/"mmm_example.csv"data=pd.read_csv(file_path,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 insightful plots and summaries. For example, we can plot the components contributions:

X=data.drop("y",axis=1)y=data["y"]mmm.fit(X,y)mmm.plot_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 ourquickstart guide and more completesimulated 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 theguide notebook.

Essential Reading for Marketing Mix Modeling (MMM)

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 ourCLV 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.

Examples

Non-contractualContractual
Continuousonline purchasesad conversion time
Discreteconcerts & sports eventsrecurring subscriptions

CLV Quickstart

importmatplotlib.pyplotaspltimportpandasaspdimportseabornassnsfrompymc_marketingimportclvfrompymc_marketing.pathsimportdata_dirfile_path=data_dir/"clv_quickstart.csv"data=pd.read_csv(data_path)data["customer_id"]=data.indexbeta_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.

Customer Choice Analysis with PyMC-Marketing

Analyze the impact of new product launches and understand customer choice behavior with ourMultivariate Interrupted Time Series (MVITS) models. Our API supports analysis in both saturated and unsaturated markets to help you:

FeatureBenefit
Market Share AnalysisUnderstand how new products affect existing product market shares
Causal Impact AssessmentMeasure the true causal effect of product launches on sales
Saturated Market AnalysisModel scenarios where total market size remains constant
Unsaturated Market AnalysisHandle cases where new products grow the total market size
Visualization ToolsPlot market shares, causal impacts, and counterfactuals
Bayesian InferenceGet uncertainty estimates around all predictions

Customer Choice Quickstart

importpandasaspdfrompymc_marketing.customer_choiceimportMVITS,plot_product# Define existing productsexisting_products= ["competitor","own"]# Create MVITS modelmvits=MVITS(existing_sales=existing_products,saturated_market=True,# Set False for unsaturated markets)# Fit modelmvits.fit(X,y)# Plot causal impact on market sharemvits.plot_causal_impact_market_share()# Plot counterfactualsmvits.plot_counterfactual()

See our example notebooks forsaturated markets andunsaturated markets to learn more about customer choice modeling with PyMC-Marketing.

Bass Diffusion Model

The Bass Diffusion Model is a popular model for predicting the adoption of new products. It is a type of product life cycle model that describes the market penetration of a new product as a function of time. PyMC-Marketing provides a flexible implementation of the Bass Diffusion Model, allowing you to customize the model parameters and fit the model to your specific data (many products).

Discrete Choice Models

Discrete choice models come in various forms, but each aims to show how choosing between a set of alternatives can be understood as a function of the observable attributes of the alternatives at hand. This type of modelling drives insight into the "must-have" features of a product, and can be used to assess the success or failure of product launches or re-launches. The PyMC-marketing implementation offers a formula based model specification, for estimating the relative utility of each good in a market and identifying their most important features.

Why PyMC-Marketing vs other solutions?

PyMC-Marketing is and will always be free for commercial use, licensed underApache 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 toopen an issue.

Thanks to our contributors!

https://github.com/pymc-labs/pymc-marketing/graphs/contributors

Marketing AI Assistant: MMM-GPT with PyMC-Marketing

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.

Try MMM-GPT here.

📞 Schedule a Free Consultation for MMM & CLV Strategy

Maximize your marketing ROI with afree 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.

About

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

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors77

Languages


[8]ページ先頭

©2009-2025 Movatter.jp