Skip to content

Commit 39f2336

Browse files
Move adstock and saturation method imports to mmm.__all__ (#908)
* Resolves #892: Move adstock and saturation method imports to mmm.__all__ * fix: patch uml GHA * Update .github/workflows/uml.yml * Update .github/workflows/uml.yml * Add permissions: write-all to .github/workflows/uml.yml --------- Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>
1 parent 41dd8a3 commit 39f2336

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

.github/workflows/uml.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
paths:
1111
- "pymc_marketing/**"
1212

13+
permissions: write-all
14+
1315
jobs:
1416
build:
1517
runs-on: ubuntu-latest
@@ -39,6 +41,9 @@ jobs:
3941
if git diff --staged --exit-code; then
4042
echo "No changes to commit"
4143
else
44+
echo "Committing the changes"
4245
git commit -m "Update UML Diagrams"
43-
git push
46+
git push origin HEAD:${GITHUB_HEAD_REF}
4447
fi
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

environment.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ dependencies:
1212
- pandas
1313
- streamlit>=1.25.0
1414
- pip
15+
- pydantic
16+
- preliz
1517
# NOTE: Keep minimum pymc version in sync with ci.yml `OLDEST_PYMC_VERSION`
1618
- pymc>=5.12.0,<5.16.0
1719
- scikit-learn>=1.1.1
@@ -41,3 +43,4 @@ dependencies:
4143
- lifetimes==0.11.3
4244
- pytest==7.0.1
4345
- pytest-cov==3.0.0
46+
- pytest-mock

pymc_marketing/mmm/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
WeibullAdstock,
2121
WeibullCDFAdstock,
2222
WeibullPDFAdstock,
23+
adstock_from_dict,
24+
register_adstock_transformation,
2325
)
2426
from pymc_marketing.mmm.components.saturation import (
2527
HillSaturation,
@@ -30,6 +32,8 @@
3032
SaturationTransformation,
3133
TanhSaturation,
3234
TanhSaturationBaselined,
35+
register_saturation_transformation,
36+
saturation_from_dict,
3337
)
3438
from pymc_marketing.mmm.delayed_saturated_mmm import MMM, DelayedSaturatedMMM
3539
from pymc_marketing.mmm.fourier import MonthlyFourier, YearlyFourier
@@ -56,9 +60,13 @@
5660
"SaturationTransformation",
5761
"TanhSaturation",
5862
"TanhSaturationBaselined",
63+
"saturation_from_dict",
64+
"register_saturation_transformation",
5965
"WeibullAdstock",
6066
"WeibullCDFAdstock",
6167
"WeibullPDFAdstock",
68+
"adstock_from_dict",
69+
"register_adstock_transformation",
6270
"YearlyFourier",
6371
"base",
6472
"delayed_saturated_mmm",

tests/mmm/components/test_adstock.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@
2020
import xarray as xr
2121
from pydantic import ValidationError
2222

23-
from pymc_marketing.mmm.components.adstock import (
24-
ADSTOCK_TRANSFORMATIONS,
23+
from pymc_marketing.mmm import (
2524
AdstockTransformation,
2625
DelayedAdstock,
2726
GeometricAdstock,
2827
WeibullAdstock,
2928
WeibullCDFAdstock,
3029
WeibullPDFAdstock,
31-
_get_adstock_function,
3230
adstock_from_dict,
3331
register_adstock_transformation,
3432
)
33+
from pymc_marketing.mmm.components.adstock import (
34+
ADSTOCK_TRANSFORMATIONS,
35+
_get_adstock_function,
36+
)
3537
from pymc_marketing.mmm.transformers import ConvMode
3638
from pymc_marketing.prior import Prior
3739

tests/mmm/components/test_saturation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
import xarray as xr
2121
from pydantic import ValidationError
2222

23-
from pymc_marketing.mmm.components.saturation import (
23+
from pymc_marketing.mmm import (
2424
HillSaturation,
2525
InverseScaledLogisticSaturation,
2626
LogisticSaturation,
2727
MichaelisMentenSaturation,
2828
RootSaturation,
2929
TanhSaturation,
3030
TanhSaturationBaselined,
31-
_get_saturation_function,
3231
saturation_from_dict,
3332
)
33+
from pymc_marketing.mmm.components.saturation import _get_saturation_function
3434
from pymc_marketing.prior import Prior
3535

3636

0 commit comments

Comments
 (0)