Skip to content

Commit 3a98c8a

Browse files
authored
Add Modified Beta Geometric model (#1301)
* Modified Beta Geometric model * Run pre-commit, skipping mypy unrelated errors * Fix convergence tests and add _model_type * Add ModBetaGeoModel to __all__ * Delete L81-82 comment on likelihood refactor * MBG tests coefficients match those of lifetimes * Delete test_numerically_stable_logp * Parametrize test_missing_cols * Rename ModBetaGeoModel -> ModifiedBetaGeoModel * Add MBG/NBD notebook * Update paper reference to MBG/NBD model in docs/source/notebooks/clv/mbg_nbd.ipynb * Improve ModifiedBetaGeoModel docstring * Updated expected_purchases docstring * Update expected_probability_alive doctring * Update expected_purchases_new_customer docstring * Mode dataframe definition out of with-block in test_customer_id_duplicate * Reduce rtol in model convergence test * Raise NotImplementedError in ModifiedBetaGeoModel.expected_probability_no_purchase. Remove part in notebook * Add Weibull Prior to notebook * Add expected_probability_no_purchase function signature. Remove associated tests. Add raise NotImplementedError test * Add MBG/NBD to clv_quickstart, index.md and README * Remove Weibull priors section in mbg_nbd.ipynb * Clear imports cell output * Add MBG/NBD notebook to index.md
1 parent 85f9016 commit 3a98c8a

File tree

10 files changed

+5232
-48
lines changed

10 files changed

+5232
-48
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ Understand and optimize your customer's value with our **CLV models**. Our API s
144144
- [Pareto/NBD model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/pareto_nbd.html)
145145
- [Gamma-Gamma model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/gamma_gamma.html)
146146
- [Shifted Beta-Geo model](https://www.pymc-marketing.io/en/stable/notebooks/clv/sBG.html)
147+
- [Modified BG/NBD model](https//pymc-marketing.readthedocs.io/en/stable/notebooks/clv/mbg_nbd.html)
147148

148149
### Examples
149150

docs/source/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ Understand and optimize your customer's value with our **CLV models**. Our API s
136136
- [Pareto/NBD model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/pareto_nbd.html)
137137
- [Gamma-Gamma model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/gamma_gamma.html)
138138
- [Shifted Beta-Geo model](https://www.pymc-marketing.io/en/stable/notebooks/clv/sBG.html)
139+
- [Modified BG/NBD model](https//pymc-marketing.readthedocs.io/en/stable/notebooks/clv/mbg_nbd.html)
139140

140141
Each of these models is tailored to different types of data and business scenarios:
141142

docs/source/notebooks/clv/clv_quickstart.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"* **[BG/BB model](https://www.pymc-marketing.io/en/latest/api/generated/pymc_marketing.clv.models.beta_geo_beta_binom.BetaGeoBetaBinomModel.html)** for discrete time, contractual modeling\n",
2525
"* **Exponential Gamma model** for discrete time, contractual modeling (coming soon)\n",
2626
"* **[Gamma-Gamma model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/gamma_gamma.html)** for expected monetary value\n",
27+
"* **[Modified BG/NBD model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/mbg_nbd.html)**, similar to [BG/NBD model](https://pymc-marketing.readthedocs.io/en/stable/notebooks/clv/bg_nbd.html) but assigning \"drop out\" probability after first purchase\n",
2728
"\n",
2829
"This table contains a breakdown of the four BTYD modeling domains, and examples for each:\n",
2930
"\n",

docs/source/notebooks/clv/mbg_nbd.ipynb

Lines changed: 4328 additions & 0 deletions
Large diffs are not rendered by default.

docs/source/notebooks/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ clv/bg_nbd
2929
clv/gamma_gamma
3030
clv/pareto_nbd
3131
clv/sBG
32+
clv/mbg_nbd
3233
:::
3334

3435
:::{toctree}

pymc_marketing/clv/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
BetaGeoModel,
1919
GammaGammaModel,
2020
GammaGammaModelIndividual,
21+
ModifiedBetaGeoModel,
2122
ParetoNBDModel,
2223
ShiftedBetaGeoModelIndividual,
2324
)
@@ -40,6 +41,7 @@
4041
"BetaGeoModel",
4142
"GammaGammaModel",
4243
"GammaGammaModelIndividual",
44+
"ModifiedBetaGeoModel",
4345
"ParetoNBDModel",
4446
"ShiftedBetaGeoModelIndividual",
4547
"customer_lifetime_value",

pymc_marketing/clv/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
GammaGammaModel,
2222
GammaGammaModelIndividual,
2323
)
24+
from pymc_marketing.clv.models.modified_beta_geo import ModifiedBetaGeoModel
2425
from pymc_marketing.clv.models.pareto_nbd import ParetoNBDModel
2526
from pymc_marketing.clv.models.shifted_beta_geo import ShiftedBetaGeoModelIndividual
2627

@@ -30,6 +31,7 @@
3031
"CLVModel",
3132
"GammaGammaModel",
3233
"GammaGammaModelIndividual",
34+
"ModifiedBetaGeoModel",
3335
"ParetoNBDModel",
3436
"ShiftedBetaGeoModelIndividual",
3537
)

0 commit comments

Comments
 (0)