Skip to content

Commit

Permalink
specify 0.9.0 as deprecation version (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 authored and twiecki committed Sep 10, 2024
1 parent d4ce864 commit 18e7841
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,26 @@ Leverage our Bayesian MMM API to tailor your marketing strategies effectively. L

```python
import pandas as pd
from pymc_marketing.mmm import MMM

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="geometric",
saturation="logistic",
adstock=GeometricAdstock(l_max=8),
saturation=LogisticSaturation(),
date_column="date_week",
channel_columns=["x1", "x2"],
control_columns=[
"event_1",
"event_2",
"t",
],
adstock_max_lag=8,
yearly_seasonality=2,
)
```
Expand All @@ -111,9 +115,6 @@ Once the model is fitted, we can further optimize our budget allocation as we ar

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.

${\color{red}\textbf{Warning!}}$ We will deprecate the `DelayedSaturatedMMM` class in the next releases.
Please use the `MMM` class instead.

### Essential Reading for Marketing Mix Modeling (MMM)

- [Bayesian Media Mix Modeling for Marketing Optimization](https://www.pymc-labs.com/blog-posts/bayesian-media-mix-modeling-for-marketing-optimization/)
Expand Down
12 changes: 10 additions & 2 deletions pymc_marketing/mmm/components/adstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ def __init__(
l_max=l_max, normalize=normalize, mode=mode, priors=priors, prefix=prefix
)

msg = f"Use the Weibull{kind}Adstock class instead for better default priors."
msg = (
f"Use the Weibull{kind}Adstock class instead for better default priors. "
"This class will deprecate in 0.9.0."
)
warnings.warn(
msg,
UserWarning,
Expand Down Expand Up @@ -383,8 +386,13 @@ def _get_adstock_function(
)

if kwargs:
msg = (
"The preferred method of initializing a "
"lagging function is to use the class directly. "
"String support will deprecate in 0.9.0."
)
warnings.warn(
"The preferred method of initializing a lagging function is to use the class directly.",
msg,
DeprecationWarning,
stacklevel=1,
)
Expand Down
13 changes: 11 additions & 2 deletions pymc_marketing/mmm/delayed_saturated_mmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,12 @@ def __init__(
self.adstock_first = adstock_first

if adstock_max_lag is not None:
msg = (
"The `adstock_max_lag` parameter is deprecated and will be removed in 0.9.0. "
"Use the `adstock` parameter directly"
)
warnings.warn(
"The `adstock_max_lag` parameter is deprecated. Use `adstock` directly",
msg,
DeprecationWarning,
stacklevel=1,
)
Expand Down Expand Up @@ -2242,8 +2246,13 @@ def __init__(
Warns that MMM class should be used instead and returns an instance of MMM with
geometric adstock and logistic saturation.
"""
msg = (
"The DelayedSaturatedMMM class is deprecated and "
"will be removed in 0.9.0. "
"Please use the MMM class instead."
)
warnings.warn(
"The DelayedSaturatedMMM class is deprecated. Please use the MMM class instead.",
msg,
DeprecationWarning,
stacklevel=1,
)
Expand Down
4 changes: 3 additions & 1 deletion tests/mmm/test_delayed_saturated_mmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,10 @@ def test_add_lift_test_measurements_no_model() -> None:


def test_delayed_saturated_mmm_raises_deprecation_warning() -> None:
match = "The DelayedSaturatedMMM class is deprecated and will be removed in 0.9.0"
with pytest.warns(
DeprecationWarning, match="The DelayedSaturatedMMM class is deprecated"
DeprecationWarning,
match=match,
):
DelayedSaturatedMMM(
date_column="date",
Expand Down

0 comments on commit 18e7841

Please sign in to comment.