Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BetaGeoBetaBinomModel #922

Closed
wants to merge 190 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
f055f98
MMM Lift test calibration (#590)
wd60622 Apr 2, 2024
8590b45
Drop python 3.9 support (#615)
juanitorduz Apr 5, 2024
27a55d5
add lift tests check
juanitorduz Apr 4, 2024
f3ec2cf
Add more content to the Gamma-Gamma Notebook (#573)
juanitorduz Apr 5, 2024
7b82cc3
Add more content to the BG/NBD Notebook (#571)
juanitorduz Apr 5, 2024
da9f025
Improve MMM Docs (#612)
juanitorduz Apr 5, 2024
38b55a2
Fix `clv` plotting bugs and edits to Quickstart (#601)
ColtAllen Apr 8, 2024
ffef5a6
[pre-commit.ci] pre-commit autoupdate (#616)
pre-commit-ci[bot] Apr 8, 2024
a151330
improve coords matching (#623)
juanitorduz Apr 11, 2024
6f33cef
python 3.12 attempt (#618)
juanitorduz Apr 11, 2024
c40c8b8
closes #520 (#621) dataset -> data
wd60622 Apr 11, 2024
ff937f4
mmm example notebook small fixes (#626)
juanitorduz Apr 12, 2024
e2dba27
Remove ruff E501 ignore (#619)
juanitorduz Apr 12, 2024
b777eb5
Update pypi.yml (dash change) (#633)
juanitorduz Apr 16, 2024
4a737cf
[pre-commit.ci] pre-commit autoupdate (#629)
pre-commit-ci[bot] Apr 16, 2024
2be2f63
UP rule ruff (#635)
juanitorduz Apr 16, 2024
582d2ed
Add ruff `RUF` rules (#636)
juanitorduz Apr 16, 2024
c02d349
Add Flake8-BugBear and Bandit (Security!) (#637)
juanitorduz Apr 18, 2024
78964f0
Update version.txt (#640)
juanitorduz Apr 19, 2024
18d926c
[pre-commit.ci] pre-commit autoupdate (#642)
pre-commit-ci[bot] Apr 23, 2024
ce41f5f
Fix build badge (#645)
juanitorduz Apr 23, 2024
818781a
Add downloads stats to README
juanitorduz Apr 25, 2024
91564cf
Pareto/NBD Example Notebook (#646)
ColtAllen Apr 25, 2024
7034e28
add spaces, increase indentation, and fix number order to Pareto note…
wd60622 Apr 27, 2024
d531d0c
Add link to new Pareto notebook (#649)
juanitorduz Apr 27, 2024
1c186f0
Plot Waterfall Components Decomposition (#631)
cetagostini-wise Apr 28, 2024
b36b0ac
Update resources.md (#652)
coreyabs-db Apr 29, 2024
ae6ae1d
fix ylabel (#654)
juanitorduz Apr 29, 2024
41dda4f
[pre-commit.ci] pre-commit autoupdate (#655)
pre-commit-ci[bot] Apr 29, 2024
a89bd93
Lift test fixes (#656)
wd60622 Apr 30, 2024
5a93ef2
add to docstrings tanh saturation (#657)
wd60622 Apr 30, 2024
b58f9b6
Add quickstart to readme (#653)
juanitorduz Apr 30, 2024
e63929a
Add contributors to README (#659)
juanitorduz May 1, 2024
f0097e2
Time varying intercept (#628)
ulfaslak May 1, 2024
8e67803
Update README.md (#660)
nialloulton May 1, 2024
fd6b331
Add tv intrecept to readme (#661)
juanitorduz May 2, 2024
b27da9e
fix title level (#663)
juanitorduz May 2, 2024
b785baa
Remove unnecessary NonImplemented errors from abstract methods (#662)
juanitorduz May 2, 2024
19bbf6d
Pass conv mode to adstock functions (#665)
juanitorduz May 2, 2024
fc37560
[Try] Fix compressed images in docs. (#667)
juanitorduz May 3, 2024
5f54d8e
Update pyproject.toml (#671)
juanitorduz May 5, 2024
0e8ac45
add license (#673)
juanitorduz May 5, 2024
48c88b2
use grep and sed in the env line (#675)
wd60622 May 6, 2024
2374a0c
add sample_kwargs (#676)
juanitorduz May 8, 2024
4dbf943
MMM NB Improvements (waterfall & error plots) (#664)
juanitorduz May 8, 2024
61da9c0
Update version.txt (#677)
juanitorduz May 8, 2024
6e37d3b
[pre-commit.ci] pre-commit autoupdate (#683)
pre-commit-ci[bot] May 13, 2024
ad2353a
v0 Streamlit MMM Explainer App (#614)
louismagowan May 21, 2024
9aa8bc0
Correct BetaGeo docstring example (#693)
wd60622 May 22, 2024
ae84163
Add `BetaGeoBetaBinom` Distribution Block (#431)
ColtAllen May 27, 2024
0e6ce83
[pre-commit.ci] pre-commit autoupdate (#705)
pre-commit-ci[bot] May 27, 2024
3feec18
Fix related to column renaming after aggregating test frequency (#698)
IvanUgrin May 28, 2024
b763c12
RFM Segmentation (#680)
ColtAllen May 28, 2024
7be19f6
create bgbb_donations.csv (#710)
ColtAllen Jun 2, 2024
b4d84cc
closes #678 (#716)
wd60622 Jun 3, 2024
ba41aef
use URL for README image (#715)
wd60622 Jun 3, 2024
86805a4
closes #264 (#714)
wd60622 Jun 3, 2024
6edc4ca
[pre-commit.ci] pre-commit autoupdate (#719)
pre-commit-ci[bot] Jun 3, 2024
f79b7b0
Update `BetaGeoModel` API (#709)
ColtAllen Jun 9, 2024
f3be754
User-defined media transformations and custom ordering (#632)
cetagostini-wise Jun 10, 2024
dc117be
CLV Plotting API (#728)
ColtAllen Jun 10, 2024
c31bee4
[pre-commit.ci] pre-commit autoupdate (#730)
pre-commit-ci[bot] Jun 10, 2024
46ba03f
Fix some ParetoNBDModel docstring typos (#731)
Mews Jun 11, 2024
b6a938f
pass kwargs to minimizer (#737)
juanitorduz Jun 12, 2024
5296f0f
Minor improvements [MMM] (#735)
juanitorduz Jun 12, 2024
271966b
Set upper bound pymc 5.16 (#725)
juanitorduz Jun 12, 2024
6fe03dc
Media transformation sampling & plotting methods (#734)
wd60622 Jun 12, 2024
664b5ca
improve tests mmm utils (#738)
juanitorduz Jun 12, 2024
a148e83
`model.fit` doesn't remove prior samples (#741)
wd60622 Jun 12, 2024
4b6607a
Hierarchical Model Configuration (#743)
wd60622 Jun 13, 2024
0144bd3
[pre-commit.ci] pre-commit autoupdate (#756)
pre-commit-ci[bot] Jun 17, 2024
c994210
MMM Component Notebook (#748)
wd60622 Jun 18, 2024
8596c8a
start addressing sphinx warnings and rendering issues (#750)
OriolAbril Jun 18, 2024
5caa61a
Allowing Hierarchical Non Centered Parametrization (#747)
cetagostini Jun 21, 2024
5ff29b1
fix np typing (#763)
juanitorduz Jun 21, 2024
405a5cf
add it back (#764)
juanitorduz Jun 21, 2024
9f84dc9
remove noqa from plots (#761)
juanitorduz Jun 21, 2024
897cf3d
Creating Time Base component for Media Contribution (#752)
cetagostini Jun 22, 2024
6a5934c
Run Ruff Notebooks (#773)
juanitorduz Jun 23, 2024
0bfca1a
[pre-commit.ci] pre-commit autoupdate (#779)
pre-commit-ci[bot] Jun 25, 2024
cec2cc2
`GammaGammaModel` API Improvements (#758)
ColtAllen Jun 27, 2024
f6a1a37
Deepcopy of posterior to allow second `fit` call (#790)
wd60622 Jun 28, 2024
fafe354
Add prior predictive example notebook (#787)
juanitorduz Jun 28, 2024
d5c3d1e
CLV Modeling Domains and Docstrings (#785)
ColtAllen Jun 28, 2024
a933b70
fix nb (#793)
juanitorduz Jun 28, 2024
576cf45
Run example notebooks CI (#791)
juanitorduz Jun 28, 2024
9892311
docs: Update model_builder.py to resolve warning in documentation bui…
c0d33ngr Jun 30, 2024
93f5e77
Time Varying Media Contribution Notebook (#778)
cetagostini Jul 1, 2024
24496a0
prepare release (#799)
juanitorduz Jul 1, 2024
2388c01
`Prior` class to represent distributions (#759)
wd60622 Jul 1, 2024
5cda250
[pre-commit.ci] pre-commit autoupdate (#801)
pre-commit-ci[bot] Jul 1, 2024
7179904
Pull out seasonality as `YearlyFourier` and `MonthlyFourier` (#802)
wd60622 Jul 5, 2024
496eb76
Separate Weibull adstock into CDF & PDF (#810)
wd60622 Jul 5, 2024
9d4d04a
Add typing and package classifiers (#811)
wd60622 Jul 5, 2024
9b691a9
add imports to mmm module (#812)
wd60622 Jul 5, 2024
03e9215
Save & load support for time varying parameters (#815)
wd60622 Jul 8, 2024
723887a
migrate to Data and non-mutable coords (#816)
wd60622 Jul 8, 2024
a97e272
[pre-commit.ci] pre-commit autoupdate (#817)
pre-commit-ci[bot] Jul 8, 2024
d766722
PoC: Use Pydantic as data validator (#809)
juanitorduz Jul 9, 2024
05abba7
Date Validation and MMM Model Hamonization (Pydantic) (#824)
juanitorduz Jul 10, 2024
d235ff4
Remove warnings during tests (#823)
wd60622 Jul 11, 2024
717702a
Future-proof `prior_linearized` method call (#806)
shuvayan Jul 11, 2024
6049ae8
Create inverse_scaled_logistic_saturation and the corresponding class…
arthurmello Jul 18, 2024
6619076
fix (#842)
juanitorduz Jul 19, 2024
4cc4ba5
use labs theme as external (#830)
OriolAbril Jul 19, 2024
7a8b627
specify 0.9.0 as deprecation version (#849)
wd60622 Jul 22, 2024
a98815f
add intercept and target variable to example (#850)
wd60622 Jul 22, 2024
cef7547
dev notebook
ColtAllen Jul 22, 2024
e6f844f
Various MMM small documentation fixes (#854)
juanitorduz Jul 22, 2024
8234c4b
Update UML diagrams (#856)
drbenvincent Jul 23, 2024
251220e
Merge branch 'pymc-labs:main' into bgbb_model
ColtAllen Jul 23, 2024
28ea158
Fixing ruff commands in Makefile #825 (#859)
MuradKhalil Jul 23, 2024
d759eb3
[pre-commit.ci] pre-commit autoupdate (#855)
pre-commit-ci[bot] Jul 24, 2024
b10f1f1
Fix model_builder docstrings (#861)
GiannisApost Jul 24, 2024
b7b97e7
add GH discussions link to README (#866)
cluhmann Jul 24, 2024
a498c5f
beta_geo_beta_binom.py
ColtAllen Jul 24, 2024
8ee9254
Skip coords with scalar value (#868)
GiannisApost Jul 25, 2024
9129a9e
Fix Visual for hill_saturation function (Issue #851 ) (#857)
PatrickRobotham Jul 25, 2024
de5679f
Allow plot MMM components in the original scale (#870)
juanitorduz Jul 25, 2024
19aea61
Inference changed to dataset (#873)
Ishaanjolly Jul 25, 2024
9755d3b
Add root saturation function (issue #702) (#858)
iraur Jul 25, 2024
78c78c1
notebook pmf testing
ColtAllen Jul 26, 2024
fabfd4e
notebook expected_purchases_new_customers
ColtAllen Jul 27, 2024
b276dcd
expected_purchases_new_customers
ColtAllen Jul 27, 2024
b2a811a
imports and WIP tests
ColtAllen Jul 27, 2024
7090401
Check for missing attrs after `sample_prior_predictive` and `fit` (#867)
wd60622 Jul 28, 2024
0a0e471
notebook mcmc testing
ColtAllen Jul 28, 2024
43131db
`json.loads` with python types bug (#881)
wd60622 Jul 29, 2024
24e9833
[pre-commit.ci] pre-commit autoupdate (#883)
pre-commit-ci[bot] Jul 29, 2024
7a89f27
Fix default `ConvMode` in docstring (#864)
ferrine Jul 29, 2024
ac645c9
Save off media transformations (#882)
wd60622 Jul 30, 2024
37cf3c8
Update deployment docs (#887)
wd60622 Jul 30, 2024
15396cd
Automate UML creation (#886)
wd60622 Jul 30, 2024
c72fb8a
prepare release (#888)
wd60622 Jul 30, 2024
4abac88
Update README.md (#893)
juanitorduz Jul 31, 2024
00d4e20
Add url health job from streamlit app (#902)
juanitorduz Aug 2, 2024
3eb5407
small improvements model config nb (#906)
juanitorduz Aug 2, 2024
dffae87
Add link model deployment to example notebook (#904)
juanitorduz Aug 2, 2024
41dd8a3
Add pymc-marketing version to some MMM notebooks (#907)
juanitorduz Aug 2, 2024
39f2336
Move adstock and saturation method imports to mmm.__all__ (#908)
PabloRoque Aug 5, 2024
ff4eef1
chore(Makefile): Adding a self-documenting command and light command …
louismagowan Aug 5, 2024
0a24151
Merge branch 'pymc-labs:main' into bgbb_model
ColtAllen Aug 5, 2024
e3c79aa
Fix uml permissions (#913)
wd60622 Aug 5, 2024
6779fd1
[pre-commit.ci] pre-commit autoupdate (#914)
pre-commit-ci[bot] Aug 6, 2024
211ba04
hierarchical default priors
ColtAllen Aug 6, 2024
789aa0d
Don't run tests for non-code changes (#898)
dandeandean Aug 7, 2024
76c6971
model config and test_expected_purchases_new_customer
ColtAllen Aug 9, 2024
767c1b0
model config and test_expected_purchases_new_customer
ColtAllen Aug 9, 2024
2a7606f
test_model and test_model_repr
ColtAllen Aug 11, 2024
6234dd9
Merge branch 'pymc-labs:main' into bgbb_model
ColtAllen Aug 11, 2024
ae4bcf8
WIP distribution_new_customers
ColtAllen Aug 11, 2024
b070375
test running budget allocator nb (#919)
juanitorduz Aug 11, 2024
285f704
make hill pass through the origin (#920)
juanitorduz Aug 12, 2024
bfeb756
Add MMM ROAS Priors Case Study (#916)
juanitorduz Aug 12, 2024
1f89294
typo (#923)
juanitorduz Aug 12, 2024
1c8fefa
[pre-commit.ci] pre-commit autoupdate (#926)
pre-commit-ci[bot] Aug 12, 2024
49ac689
Original hill function definition (#925)
juanitorduz Aug 12, 2024
c7027f0
Merge branch 'pymc-labs:main' into bgbb_model
ColtAllen Aug 13, 2024
d4e1d09
default_model_config and test_model
ColtAllen Aug 13, 2024
93fc9d9
MLflow autologging (#921)
wd60622 Aug 14, 2024
c1b5933
Adding BLAS to the env generation.
cetagostini Aug 14, 2024
35c8850
Merge branch 'main' of https://github.com/pymc-labs/pymc-marketing
cetagostini Aug 14, 2024
809a079
Solving optimizer issues & typos (#933)
cetagostini Aug 17, 2024
8d116b5
Log number of posterior & tuning samples (#943)
wd60622 Aug 18, 2024
5bbce01
point to GH discussions (#944)
cluhmann Aug 19, 2024
3126ae0
[pre-commit.ci] pre-commit autoupdate (#946)
pre-commit-ci[bot] Aug 19, 2024
f6c6825
Fallback to defaults in `adstock|saturation_from_dict` (#955)
PabloRoque Aug 22, 2024
39d38b7
Add PyDocStyle Support (#951)
juanitorduz Aug 22, 2024
255eac1
deprecate WeibullAdstock in favor of WeibullCDFAdstock and WeibullPDF…
wd60622 Aug 22, 2024
943a2c4
Raise informative error when including target in `X` (#962)
cluhmann Aug 22, 2024
1536dad
Ensure `fit` reproducibility (#963)
wd60622 Aug 22, 2024
b478d9d
Enforce `check_parameters` for `alpha` in `geometric_adstock` (#960)
PabloRoque Aug 22, 2024
bb8d063
scaling should be done before hdi computation (#970)
juanitorduz Aug 24, 2024
7d3b832
Fix UML permissions from forks / Run only on merge to main (#967)
wd60622 Aug 24, 2024
288b8e8
`DelayedSaturatedMMM` deprecations and moving files (#965)
wd60622 Aug 24, 2024
0c90ba8
Register and allow custom transform for `Prior` class (#972)
wd60622 Aug 25, 2024
cc89b95
Update pypi.yml (#975)
juanitorduz Aug 26, 2024
16b10ba
[pre-commit.ci] pre-commit autoupdate (#977)
pre-commit-ci[bot] Aug 26, 2024
28b75c3
Added deprecation warning for method keyword (#974)
radiokosmos Aug 26, 2024
6c46d59
Improve and sync the README and landing page. (#978)
juanitorduz Aug 28, 2024
cafa3f8
Time slice cross validation MMM Notebook (#971)
juanitorduz Aug 29, 2024
3048a74
fix the wrong trigger (#983)
wd60622 Aug 29, 2024
f2318ae
Media transformation class and different transformations based on sub…
wd60622 Aug 29, 2024
2e2907a
Changed pt=pt to pt_lib = None to avoid showing full module path in d…
radiokosmos Sep 1, 2024
f1e86c9
Linear trend (#991)
wd60622 Sep 2, 2024
292bd7c
[pre-commit.ci] pre-commit autoupdate (#994)
pre-commit-ci[bot] Sep 2, 2024
4e2d722
always push to main (#993)
wd60622 Sep 3, 2024
8468576
Vectorize _logp method of BetaGeoBetaBinomial model
ricardoV94 Sep 3, 2024
6e0e2a2
Merge branch 'pymc-labs:main' into bgbb_model
ColtAllen Sep 4, 2024
ae56d88
fix test_distribution_new_customer
ColtAllen Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 6 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,13 @@ on:
branches: [main]

env:
OLDEST_PYMC_VERSION: "5.10.4"
# The lower bound from the pyproject.toml file
OLDEST_PYMC_VERSION: "$(grep -E 'pymc *>' pyproject.toml | sed -n 's/.*>=\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*/\\1/p')"

jobs:
test:
pre-commit:
runs-on: ubuntu-latest
strategy:
matrix:
config: [ {python-version: "3.9", oldest-pymc: false}, {python-version: "3.11", oldest-pymc: true}]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.config.python-version }}
- name: Install oldest version of PyMC
if: ${{ matrix.config.oldest-pymc }}
run: pip install pymc==${{ env.OLDEST_PYMC_VERSION }}
- name: Run tests
run: |
pip install -e .[test]
pytest --cov-report=xml --no-cov-on-fail --durations=50
- name: Check oldest version of PyMC
if: ${{ matrix.config.oldest-pymc }}
run: python -c "import pymc; assert pymc.__version__ == '${{ env.OLDEST_PYMC_VERSION }}'"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: ${{ matrix.config.python-version }}
fail_ci_if_error: false

test_slow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Run tests
run: |
pip install -e .[test]
pytest --only-slow --cov-report=xml --no-cov-on-fail --durations=50
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: "test_slow"
fail_ci_if_error: false

all:
if: ${{ always() }}
runs-on: ubuntu-latest
name: All checks
needs: [ test, test_slow ]
steps:
- name: Confirm checks passed
if: ${{ (needs.test.result != 'success' || needs.test_slow.result != 'success') }}
run: exit 1
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
16 changes: 8 additions & 8 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Build the sdist and the wheel
run: |
pip install build
Expand All @@ -27,7 +27,7 @@ jobs:
mkdir -p test-sdist
cd test-sdist
python -m venv venv-sdist
venv-sdist/bin/python -m pip install ../dist/pymc-marketing*.tar.gz
venv-sdist/bin/python -m pip install ../dist/pymc_marketing*.tar.gz
echo "Checking import and version number (on release)"
venv-sdist/bin/python -c "import pymc_marketing as pmm; assert pmm.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else pmm.__version__; print(pmm.__version__)"
cd ..
Expand All @@ -45,6 +45,8 @@ jobs:
name: artifact
path: dist/*
test:
permissions:
id-token: write
name: upload to test PyPI
needs: [build]
runs-on: ubuntu-latest
Expand All @@ -57,12 +59,10 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Test pip install from test.pypi
run: |
python -m venv venv-test-pypi
Expand All @@ -71,6 +71,9 @@ jobs:
venv-test-pypi/bin/python -c "import pymc_marketing; assert pymc_marketing.__version__ == '${{ github.ref_name }}'"

publish:
environment: release
permissions:
id-token: write
name: upload release to PyPI
needs: [build, test]
runs-on: ubuntu-latest
Expand All @@ -81,6 +84,3 @@ jobs:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/streamlit_url_health.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: URL Health

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 */6 * * *'

jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Check the deployed service URL
uses: jtalk/url-health-check-action@v4
with:
# Check the following URLs one by one sequentially
url: https://pymc-marketing-app.streamlit.app/
# Follow redirects, or just report success on 3xx status codes
follow-redirect: false # Optional, defaults to false
# Fail this action after this many failed attempts
max-attempts: 3 # Optional, defaults to 1
# Delay between retries
retry-delay: 5s # Optional, only applicable to max-attempts > 1
72 changes: 72 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test

on:
pull_request:
branches: [main]
paths: '**.py'
push:
branches: [main]
paths: '**.py'

env:
# The lower bound from the pyproject.toml file
OLDEST_PYMC_VERSION: "$(grep -E 'pymc *>' pyproject.toml | sed -n 's/.*>=\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*/\\1/p')"

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
config: [ {python-version: "3.10", oldest-pymc: false}, {python-version: "3.12", oldest-pymc: true}]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.config.python-version }}
- name: Install oldest version of PyMC
if: ${{ matrix.config.oldest-pymc }}
run: pip install pymc==${{ env.OLDEST_PYMC_VERSION }}
- name: Run tests
run: |
sudo apt-get install graphviz
pip install -e .[test]
pytest --cov-report=xml --no-cov-on-fail --durations=50
- name: Check oldest version of PyMC
if: ${{ matrix.config.oldest-pymc }}
run: python -c "import pymc; assert pymc.__version__ == '${{ env.OLDEST_PYMC_VERSION }}'"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: ${{ matrix.config.python-version }}
fail_ci_if_error: false

test_slow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Run tests
run: |
pip install -e .[test]
pytest --only-slow --cov-report=xml --no-cov-on-fail --durations=50
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: "test_slow"
fail_ci_if_error: false

all:
if: ${{ always() }}
runs-on: ubuntu-latest
name: All checks
needs: [ test, test_slow ]
steps:
- name: Confirm checks passed
if: ${{ (needs.test.result != 'success' || needs.test_slow.result != 'success') }}
run: exit 1
30 changes: 30 additions & 0 deletions .github/workflows/test_notebook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test Notebook

on:
pull_request:
branches: [main]
paths:
- '**.py'
- '**.ipynb'
push:
branches: [main]
paths:
- '**.py'
- '**.ipynb'

jobs:
example_notebooks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
sudo apt-get install graphviz
pip install -e .[docs]
pip install -e .[test]
- name: Run notebooks
run: make run_notebooks
47 changes: 47 additions & 0 deletions .github/workflows/uml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Update the UML Diagrams

on:
pull_request:
types: [closed]
branches: [main]
paths:
- "pymc_marketing/**"

jobs:
build:
if: github.event.pull_request.head.repo.owner.login == 'pymc-labs'
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Configure Git Identity
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"

- name: Update the UML Diagrams
run: |
sudo apt-get update && sudo apt-get install -y graphviz
make uml

- name: Push up the changes
run: |
git add docs/source/uml/*.png
if git diff --staged --exit-code; then
echo "No changes to commit"
else
echo "Committing the changes"
git commit -m "Update UML Diagrams"
git push origin HEAD:main
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# MLflow logging
mlruns/
mlruns.db

# InferenceData
*.nc

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
27 changes: 16 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,37 @@ ci:
autofix_prs: false

repos:
- repo: https://github.com/lucianopaz/head_of_apache
rev: "0.0.3"
hooks:
- id: head_of_apache
args:
- --author=The PyMC Labs Developers
- --exclude=docs/
- --exclude=scripts/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.6.3
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: ["--fix", "--output-format=full"]
exclude: ^docs/source/notebooks/clv/dev/
- id: ruff-format
types_or: [python, pyi, jupyter]
exclude: ^docs/source/notebooks/clv/dev/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.11.2
hooks:
- id: mypy
args: [--ignore-missing-imports]
files: ^pymc_marketing/
additional_dependencies: [numpy>=1.20, pandas-stubs]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: nbqa-ruff
args: ["--fix", "--output-format=full"]
files: ^docs/source/notebooks/
exclude: ^docs/source/notebooks/clv/dev/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: debug-statements
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^notebooks/
exclude: ^docs/source/notebooks/
Loading
Loading