Skip to content

Commit 688ef85

Browse files
wd60622twiecki
authored andcommitted
specify 0.9.0 as deprecation version (#849)
1 parent 887a698 commit 688ef85

File tree

4 files changed

+32
-12
lines changed

4 files changed

+32
-12
lines changed

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,26 @@ Leverage our Bayesian MMM API to tailor your marketing strategies effectively. L
7272

7373
```python
7474
import pandas as pd
75-
from pymc_marketing.mmm import MMM
75+
76+
from pymc_marketing.mmm import (
77+
GeometricAdstock,
78+
LogisticSaturation,
79+
MMM,
80+
)
7681

7782
data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/mmm_example.csv"
7883
data = pd.read_csv(data_url, parse_dates=["date_week"])
7984

8085
mmm = MMM(
81-
adstock="geometric",
82-
saturation="logistic",
86+
adstock=GeometricAdstock(l_max=8),
87+
saturation=LogisticSaturation(),
8388
date_column="date_week",
8489
channel_columns=["x1", "x2"],
8590
control_columns=[
8691
"event_1",
8792
"event_2",
8893
"t",
8994
],
90-
adstock_max_lag=8,
9195
yearly_seasonality=2,
9296
)
9397
```
@@ -111,9 +115,6 @@ Once the model is fitted, we can further optimize our budget allocation as we ar
111115

112116
Explore a hands-on [simulated example](https://pymc-marketing.readthedocs.io/en/stable/notebooks/mmm/mmm_example.html) for more insights into MMM with PyMC-Marketing.
113117

114-
${\color{red}\textbf{Warning!}}$ We will deprecate the `DelayedSaturatedMMM` class in the next releases.
115-
Please use the `MMM` class instead.
116-
117118
### Essential Reading for Marketing Mix Modeling (MMM)
118119

119120
- [Bayesian Media Mix Modeling for Marketing Optimization](https://www.pymc-labs.com/blog-posts/bayesian-media-mix-modeling-for-marketing-optimization/)

pymc_marketing/mmm/components/adstock.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ def __init__(
332332
l_max=l_max, normalize=normalize, mode=mode, priors=priors, prefix=prefix
333333
)
334334

335-
msg = f"Use the Weibull{kind}Adstock class instead for better default priors."
335+
msg = (
336+
f"Use the Weibull{kind}Adstock class instead for better default priors. "
337+
"This class will deprecate in 0.9.0."
338+
)
336339
warnings.warn(
337340
msg,
338341
UserWarning,
@@ -383,8 +386,13 @@ def _get_adstock_function(
383386
)
384387

385388
if kwargs:
389+
msg = (
390+
"The preferred method of initializing a "
391+
"lagging function is to use the class directly. "
392+
"String support will deprecate in 0.9.0."
393+
)
386394
warnings.warn(
387-
"The preferred method of initializing a lagging function is to use the class directly.",
395+
msg,
388396
DeprecationWarning,
389397
stacklevel=1,
390398
)

pymc_marketing/mmm/delayed_saturated_mmm.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ def __init__(
173173
self.adstock_first = adstock_first
174174

175175
if adstock_max_lag is not None:
176+
msg = (
177+
"The `adstock_max_lag` parameter is deprecated and will be removed in 0.9.0. "
178+
"Use the `adstock` parameter directly"
179+
)
176180
warnings.warn(
177-
"The `adstock_max_lag` parameter is deprecated. Use `adstock` directly",
181+
msg,
178182
DeprecationWarning,
179183
stacklevel=1,
180184
)
@@ -2242,8 +2246,13 @@ def __init__(
22422246
Warns that MMM class should be used instead and returns an instance of MMM with
22432247
geometric adstock and logistic saturation.
22442248
"""
2249+
msg = (
2250+
"The DelayedSaturatedMMM class is deprecated and "
2251+
"will be removed in 0.9.0. "
2252+
"Please use the MMM class instead."
2253+
)
22452254
warnings.warn(
2246-
"The DelayedSaturatedMMM class is deprecated. Please use the MMM class instead.",
2255+
msg,
22472256
DeprecationWarning,
22482257
stacklevel=1,
22492258
)

tests/mmm/test_delayed_saturated_mmm.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,10 @@ def test_add_lift_test_measurements_no_model() -> None:
10001000

10011001

10021002
def test_delayed_saturated_mmm_raises_deprecation_warning() -> None:
1003+
match = "The DelayedSaturatedMMM class is deprecated and will be removed in 0.9.0"
10031004
with pytest.warns(
1004-
DeprecationWarning, match="The DelayedSaturatedMMM class is deprecated"
1005+
DeprecationWarning,
1006+
match=match,
10051007
):
10061008
DelayedSaturatedMMM(
10071009
date_column="date",

0 commit comments

Comments
 (0)