Skip to content

Commit b446fb5

Browse files
authored
Migrate to prior module from pymc-extras (#1767)
1 parent 84fc81a commit b446fb5

File tree

75 files changed

+1999
-4590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1999
-4590
lines changed

docs/source/guide/benefits/model_deployment.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"import matplotlib.pyplot as plt\n",
4747
"import numpy as np\n",
4848
"import pandas as pd\n",
49+
"from pymc_extras.prior import Prior\n",
4950
"\n",
5051
"from pymc_marketing.mmm import MMM, GeometricAdstock, LogisticSaturation\n",
51-
"from pymc_marketing.prior import Prior\n",
5252
"\n",
5353
"az.style.use(\"arviz-darkgrid\")\n",
5454
"plt.rcParams[\"figure.figsize\"] = [12, 7]\n",

docs/source/notebooks/bass/bass_example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@
215215
"import pandas as pd\n",
216216
"import pymc as pm\n",
217217
"import xarray as xr\n",
218+
"from pymc_extras.prior import Prior, Scaled\n",
218219
"\n",
219220
"from pymc_marketing.bass.model import create_bass_model\n",
220221
"from pymc_marketing.plot import plot_curve\n",
221-
"from pymc_marketing.prior import Prior, Scaled\n",
222222
"\n",
223223
"az.style.use(\"arviz-darkgrid\")\n",
224224
"plt.rcParams[\"figure.figsize\"] = [12, 7]\n",

docs/source/notebooks/clv/clv_quickstart.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"import numpy as np\n",
4949
"import pandas as pd\n",
5050
"from arviz.labels import MapLabeller\n",
51+
"from pymc_extras.prior import Prior\n",
5152
"\n",
52-
"from pymc_marketing import clv\n",
53-
"from pymc_marketing.prior import Prior"
53+
"from pymc_marketing import clv"
5454
]
5555
},
5656
{

docs/source/notebooks/clv/dev/beta_geo_beta_binom.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"\n",
1515
"import pymc as pm\n",
1616
"from pymc_marketing.clv import BetaGeoBetaBinomModel\n",
17-
"from pymc_marketing.prior import Prior"
17+
"from pymc_extras.prior import Prior"
1818
]
1919
},
2020
{

docs/source/notebooks/clv/dev/bg_nbg_covariates_test_issues.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"from fastprogress.fastprogress import progress_bar\n",
3939
"\n",
4040
"from pymc_marketing import clv\n",
41-
"from pymc_marketing.prior import Prior\n",
41+
"from pymc_extras.prior import Prior\n",
4242
"\n",
4343
"from tests.conftest import set_model_fit\n",
4444
"\n",

docs/source/notebooks/clv/dev/utilities_plotting.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"\n",
1616
"from pymc_marketing.clv import utils\n",
1717
"from pymc_marketing.clv import ParetoNBDModel\n",
18-
"from pymc_marketing.prior import Prior\n",
18+
"from pymc_extras.prior import Prior\n",
1919
"\n",
2020
"from pymc_marketing.clv import utils, plotting"
2121
]

docs/source/notebooks/clv/pareto_nbd.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"import xarray as xr\n",
3737
"from fastprogress.fastprogress import progress_bar\n",
3838
"from lifetimes import ParetoNBDFitter\n",
39+
"from pymc_extras.prior import Prior\n",
3940
"\n",
4041
"from pymc_marketing import clv\n",
41-
"from pymc_marketing.prior import Prior\n",
4242
"\n",
4343
"# Plotting configuration\n",
4444
"az.style.use(\"arviz-darkgrid\")\n",

docs/source/notebooks/general/model_configuration.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
"import numpy as np\n",
3232
"import pandas as pd\n",
3333
"import pymc as pm\n",
34+
"from pymc_extras.prior import Prior\n",
3435
"\n",
3536
"from pymc_marketing.model_config import ModelConfigError, parse_model_config\n",
36-
"from pymc_marketing.prior import Prior\n",
3737
"\n",
3838
"az.style.use(\"arviz-darkgrid\")\n",
3939
"plt.rcParams[\"figure.figsize\"] = [12, 7]\n",
@@ -62,7 +62,7 @@
6262
"source": [
6363
"## Prior Distributions\n",
6464
"\n",
65-
"The {class}`~pymc_marketing.prior.Prior` class is our way to expression distributions and relationships between them.\n",
65+
"The {class}`~pymc_extras.prior.Prior` class is our way to expression distributions and relationships between them.\n",
6666
"\n",
6767
"### Basic Usage\n",
6868
"\n",
@@ -1673,7 +1673,7 @@
16731673
" nrows=2, ncols=1, figsize=(10, 9), sharex=True, sharey=True, layout=\"constrained\"\n",
16741674
")\n",
16751675
"\n",
1676-
"az.plot_posterior(prior, var_names=[\"var\"], grid=(2, 1), ax=axes)\n",
1676+
"az.plot_posterior(prior, var_names=[\"variable\"], grid=(2, 1), ax=axes)\n",
16771677
"fig.suptitle(\"Prior Distribution\", fontsize=18, fontweight=\"bold\");"
16781678
]
16791679
},
@@ -1714,7 +1714,7 @@
17141714
" return df.plot.scatter(x=x, y=y, title=title)\n",
17151715
"\n",
17161716
"\n",
1717-
"ax = prior[\"var\"].to_series().unstack().pipe(plot_correlation)\n",
1717+
"ax = prior[\"variable\"].to_series().unstack().pipe(plot_correlation)\n",
17181718
"padding = 0.025\n",
17191719
"bounds = (0 - padding, 1 + padding)\n",
17201720
"ax.set(xlim=bounds, ylim=bounds);"

docs/source/notebooks/general/prior_predictive.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"(prior_predictive)=\n",
88
"# Prior Predictive Modeling\n",
99
"\n",
10-
"This guide provides an introduction to prior predictive modeling using PyMC (and PyMC-Marketing) and the {class}`Prior <pymc_marketing.prior.Prior>` class from PyMC-Marketing. We start by looking into a simpler example and then we will see how to apply to real case scenarios with marketing mix models in PyMC-Marketing.\n",
10+
"This guide provides an introduction to prior predictive modeling using PyMC (and PyMC-Marketing) and the {class}`Prior <pymc_extras.prior.Prior>` class from PyMC-Marketing. We start by looking into a simpler example and then we will see how to apply to real case scenarios with marketing mix models in PyMC-Marketing.\n",
1111
"\n",
1212
"\n",
1313
"Before diving into the technical details, let's understand why priors are crucial in Bayesian analysis and their practical importance in industry applications.\n",
@@ -135,7 +135,7 @@
135135
"3. **Model Sensitivity**: \n",
136136
" The relationship between $\\theta^{(s)}$ and $y^{(s)}$ shows how parameters influence predictions\n",
137137
"\n",
138-
"Let's explore these concepts through practical examples using the {class}`Prior <pymc_marketing.prior.Prior>` class from PyMC-Marketing.\n"
138+
"Let's explore these concepts through practical examples using the {class}`Prior <pymc_extras.prior.Prior>` class from PyMC-Marketing.\n"
139139
]
140140
},
141141
{
@@ -161,11 +161,11 @@
161161
"import pymc as pm\n",
162162
"import seaborn as sns\n",
163163
"from numpy.typing import NDArray\n",
164+
"from pymc_extras.prior import Prior\n",
164165
"\n",
165166
"from pymc_marketing.hsgp_kwargs import HSGPKwargs\n",
166167
"from pymc_marketing.mmm import MMM, GeometricAdstock, LogisticSaturation\n",
167168
"from pymc_marketing.paths import data_dir\n",
168-
"from pymc_marketing.prior import Prior\n",
169169
"\n",
170170
"seed: int = sum(map(ord, \"prior\"))\n",
171171
"rng: np.random.Generator = np.random.default_rng(seed=seed)\n",
@@ -1975,7 +1975,7 @@
19751975
"## Key Takeaways\n",
19761976
"\n",
19771977
"1. Prior predictive modeling helps us validate our model assumptions before using real data\n",
1978-
"2. The {class}`Prior <pymc_marketing.prior.prior.Prior>` class provides a convenient interface for:\n",
1978+
"2. The {class}`Prior <pymc_extras.prior.prior.Prior>` class provides a convenient interface for:\n",
19791979
" - Creating and visualizing prior distributions\n",
19801980
" - Sampling from prior predictive distributions\n",
19811981
"3. Always visualize your prior predictive distributions to ensure they align with your domain knowledge\n",

docs/source/notebooks/mmm/mmm_case_study.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
"import numpy as np\n",
5757
"import pandas as pd\n",
5858
"import seaborn as sns\n",
59+
"from pymc_extras.prior import Prior\n",
5960
"\n",
6061
"from pymc_marketing.metrics import crps\n",
6162
"from pymc_marketing.mmm import MMM, GeometricAdstock, LogisticSaturation\n",
6263
"from pymc_marketing.mmm.utils import apply_sklearn_transformer_across_dim\n",
63-
"from pymc_marketing.prior import Prior\n",
6464
"\n",
6565
"warnings.filterwarnings(\"ignore\", category=FutureWarning)\n",
6666
"\n",

0 commit comments

Comments
 (0)