In this package we provide an API for a Bayesian media mix model (MMM) specification following Jin, Yuxue, et al. “Bayesian methods for media mix modeling with carryover and shape effects.” (2017).. Concretely, given a time series target variable
where
Here you can find a simulated example:
- First, we describe the data genaration process of a simulated dataset.
- Next, we describe how to specify and fit a media mix model (as described above) using the
pymc-marketing
MMM's API. - Finally, we describe the model results: channel constribution and ROAS estimation. We also show how the model recovers the parameters from the data generation process step.
- Jin, Yuxue, et al. “Bayesian methods for media mix modeling with carryover and shape effects.” (2017).
- PyMC Labs Blog:
- Johns, Michael and Wang, Zhenyu. "A Bayesian Approach to Media Mix Modeling"
- Orduz, Juan. "Media Effect Estimation with PyMC: Adstock, Saturation & Diminishing Returns"
Customer Lifetime Value models is another important class of models. There are many different types of CLV models and it can be helpful to conceptualise them as fitting in a 2-dimensional grid as below. An excellent set of introduction slides to CLV's is provided in Probability Models for Customer-Base Analysis by Fader & Hardie (2009).
Non-contractual | Contractual | |
---|---|---|
Continuous | Buying groceries | Audible |
Discrete | Cinema ticket | Monthly or yearly subscriptions |
To explain further:
-
Contractual: In contractual settings a customer has a contract which continues to be active until it is explicitly cancelled. Therefore in contractual settings, customer churn events are observed.
-
Non-contractual: In non-contractual settings, there is no ongoing contract that a customer has with a company. Instead, purchases can be ad hoc and churn events are unobserved.
-
Discrete: Here, purchases are made at discrete points in time. This obviously depends upon the timescale that we are working on, but typically a relevant time period would be a month or year. However it could be more granualar than this - think of taking the 2nd of 4 inter-city train journeys offered per day.
-
Continuous: In the continuous-time domain, purchases can be made at any point within a firms opening hours. For online ordering this could be any point within a 24 hour cycle, or purchases in physical stores could be made at any point during the trading day.
In the documentation we provide some examples on how to use the CLV API. We use the data from the lifetimes
package to illustrate the models.
- Create conda environment. For example:
conda create -n pymc_marketing_env
- Activate environment.
conda activate pymc_marketing_env
- Install
pymc_marketing
package:
make init
- To run tests:
make test
- To check code style:
make check_lint
- Set pre-commit hooks (Optional):
pre-commit install