Skip to content

Commit 0afd499

Browse files
committed
Search-and-replace a bunch of strings to port to v4.
1 parent f033fb2 commit 0afd499

File tree

115 files changed

+2420
-2427
lines changed

Some content is hidden

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

115 files changed

+2420
-2427
lines changed

examples/case_studies/BEST.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"name": "stdout",
1717
"output_type": "stream",
1818
"text": [
19-
"Running on PyMC3 v3.11.0\n"
19+
"Running on PyMC v3.11.0\n"
2020
]
2121
}
2222
],
@@ -25,9 +25,9 @@
2525
"import matplotlib.pyplot as plt\n",
2626
"import numpy as np\n",
2727
"import pandas as pd\n",
28-
"import pymc3 as pm\n",
28+
"import pymc as pm\n",
2929
"\n",
30-
"print(f\"Running on PyMC3 v{pm.__version__}\")"
30+
"print(f\"Running on PyMC v{pm.__version__}\")"
3131
]
3232
},
3333
{
@@ -222,7 +222,7 @@
222222
"cell_type": "markdown",
223223
"metadata": {},
224224
"source": [
225-
"Since PyMC3 parameterizes the Student-T in terms of precision, rather than standard deviation, we must transform the standard deviations before specifying our likelihoods."
225+
"Since PyMC parameterizes the Student-T in terms of precision, rather than standard deviation, we must transform the standard deviations before specifying our likelihoods."
226226
]
227227
},
228228
{
@@ -323,7 +323,7 @@
323323
],
324324
"source": [
325325
"with model:\n",
326-
" trace = pm.sample(2000, return_inferencedata=True)"
326+
" trace = pm.sample(2000)"
327327
]
328328
},
329329
{
@@ -574,7 +574,7 @@
574574
"source": [
575575
"The original pymc2 implementation was written by Andrew Straw and can be found here: https://github.com/strawlab/best\n",
576576
"\n",
577-
"Ported to PyMC3 by [Thomas Wiecki](https://twitter.com/twiecki) (c) 2015, updated by Chris Fonnesbeck."
577+
"Ported to PyMC by [Thomas Wiecki](https://twitter.com/twiecki) (c) 2015, updated by Chris Fonnesbeck."
578578
]
579579
},
580580
{
@@ -596,7 +596,7 @@
596596
"numpy : 1.19.2\n",
597597
"matplotlib: 3.3.2\n",
598598
"arviz : 0.11.2\n",
599-
"pymc3 : 3.11.0\n",
599+
"pymc : 3.11.0\n",
600600
"\n",
601601
"Watermark: 2.2.0\n",
602602
"\n"

examples/case_studies/GHME_2013.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import numpy as np
33
import pandas as pd
44

5-
from pymc3 import HalfCauchy, Model, Normal, get_data, sample
6-
from pymc3.distributions.timeseries import GaussianRandomWalk
5+
from pymc import HalfCauchy, Model, Normal, get_data, sample
6+
from pymc.distributions.timeseries import GaussianRandomWalk
77

88
data = pd.read_csv(get_data("pancreatitis.csv"))
99
countries = ["CYP", "DNK", "ESP", "FIN", "GBR", "ISL"]

examples/case_studies/LKJ.ipynb

+12-12
Large diffs are not rendered by default.

examples/case_studies/baseball.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import numpy as np
77

8-
import pymc3 as pm
8+
import pymc as pm
99

1010

1111
def build_model():

examples/case_studies/bayesian_ab_testing.ipynb

+17-17
Large diffs are not rendered by default.

examples/case_studies/binning.ipynb

+55-55
Large diffs are not rendered by default.

examples/case_studies/blackbox_external_likelihood.ipynb

+55-55
Large diffs are not rendered by default.

examples/case_studies/blackbox_external_likelihood_numpy.ipynb

+60-60
Large diffs are not rendered by default.

examples/case_studies/conditional-autoregressive-model.ipynb

+91-91
Large diffs are not rendered by default.

examples/case_studies/disaster_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from numpy import arange, array
1515

16-
import pymc3 as pm
16+
import pymc as pm
1717

1818
__all__ = ["disasters_data", "switchpoint", "early_mean", "late_mean", "rate", "disasters"]
1919

examples/case_studies/disaster_model_theano_op.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from numpy import arange, array, empty
1111
from theano.compile.ops import as_op
1212

13-
import pymc3 as pm
13+
import pymc as pm
1414

1515
__all__ = ["disasters_data", "switchpoint", "early_mean", "late_mean", "rate", "disasters"]
1616

examples/case_studies/factor_analysis.ipynb

+22-24
Large diffs are not rendered by default.

examples/case_studies/garch_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import theano.tensor as tt
33

44
from arviz import summary
5-
from pymc3 import Model, Normal, Uniform, sample
5+
from pymc import Model, Normal, Uniform, sample
66

77
"""
88
Example from Stan - slightly altered

examples/case_studies/gelman_bioassay.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from numpy import array, ones
22

3-
import pymc3 as pm
3+
import pymc as pm
44

55
# Samples for each dose level
66
n = 5 * ones(4, dtype=int)

examples/case_studies/gelman_schools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from arviz import loo
4-
from pymc3 import HalfCauchy, Model, Normal, sample
4+
from pymc import HalfCauchy, Model, Normal, sample
55

66
"""Original Stan model
77

examples/case_studies/hierarchical_partial_pooling.ipynb

+9-9
Large diffs are not rendered by default.

examples/case_studies/item_response_nba.ipynb

+12-12
Large diffs are not rendered by default.

examples/case_studies/lasso_missing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from numpy.ma import masked_values
44

5-
import pymc3 as pm
5+
import pymc as pm
66

77
# Import data, filling missing values with sentinels (-999)
88
test_scores = pd.read_csv(pm.get_data("test_scores.csv")).fillna(-999)

examples/case_studies/lightspeed_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22
import arviz as az
3-
import pymc3 as pm
3+
import pymc as pm
44

55
light_speed = np.array(
66
[

examples/case_studies/log-gaussian-cox-process.ipynb

+10-10
Large diffs are not rendered by default.

examples/case_studies/mediation_analysis.ipynb

+9-9
Large diffs are not rendered by default.

examples/case_studies/moderation_analysis.ipynb

+12-12
Large diffs are not rendered by default.

examples/case_studies/multilevel_modeling.ipynb

+48-51
Large diffs are not rendered by default.

examples/case_studies/probabilistic_matrix_factorization.ipynb

+346-346
Large diffs are not rendered by default.

examples/case_studies/putting_workflow.ipynb

+22-22
Large diffs are not rendered by default.

examples/case_studies/rugby_analytics.ipynb

+18-18
Large diffs are not rendered by default.

examples/case_studies/stochastic_volatility.ipynb

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"import matplotlib.pyplot as plt\n",
2020
"import numpy as np\n",
2121
"import pandas as pd\n",
22-
"import pymc3 as pm\n",
22+
"import pymc as pm\n",
2323
"\n",
2424
"rng = np.random.default_rng(0)\n",
2525
"az.style.use(\"arviz-darkgrid\")"
@@ -182,7 +182,7 @@
182182
"cell_type": "markdown",
183183
"metadata": {},
184184
"source": [
185-
"Specifying the model in `PyMC3` mirrors its statistical specification. "
185+
"Specifying the model in `PyMC` mirrors its statistical specification. "
186186
]
187187
},
188188
{
@@ -313,7 +313,7 @@
313313
"outputs": [],
314314
"source": [
315315
"with stochastic_vol_model:\n",
316-
" trace = az.from_pymc3(prior=pm.sample_prior_predictive(500))\n",
316+
" trace = pm.to_inference_data(prior=pm.sample_prior_predictive(500))\n",
317317
"\n",
318318
"prior_predictive = trace.prior_predictive.stack(pooled_chain=(\"chain\", \"draw\"))"
319319
]
@@ -443,7 +443,7 @@
443443
],
444444
"source": [
445445
"with stochastic_vol_model:\n",
446-
" trace.extend(pm.sample(2000, tune=2000, return_inferencedata=True))\n",
446+
" trace.extend(pm.sample(2000, tune=2000))\n",
447447
"\n",
448448
"posterior = trace.posterior.stack(pooled_chain=(\"chain\", \"draw\"))\n",
449449
"posterior[\"exp_volatility\"] = np.exp(posterior[\"volatility\"])"
@@ -486,7 +486,7 @@
486486
],
487487
"source": [
488488
"with stochastic_vol_model:\n",
489-
" trace.extend(az.from_pymc3(posterior_predictive=pm.sample_posterior_predictive(trace)))\n",
489+
" trace.extend(pm.to_inference_data(posterior_predictive=pm.sample_posterior_predictive(trace)))\n",
490490
"\n",
491491
"posterior_predictive = trace.posterior_predictive.stack(pooled_chain=(\"chain\", \"draw\"))"
492492
]
@@ -615,14 +615,14 @@
615615
"Python version : 3.8.5\n",
616616
"IPython version : 7.13.0\n",
617617
"\n",
618-
"theano: 1.1.2\n",
618+
"aesara: 1.1.2\n",
619619
"xarray: 0.17.0\n",
620620
"\n",
621621
"matplotlib: 3.3.4\n",
622622
"pandas : 1.2.1\n",
623623
"arviz : 0.11.2\n",
624624
"numpy : 1.18.5\n",
625-
"pymc3 : 3.11.2\n",
625+
"pymc : 3.11.2\n",
626626
"\n",
627627
"Watermark: 2.2.0\n",
628628
"\n"
@@ -631,7 +631,7 @@
631631
],
632632
"source": [
633633
"%load_ext watermark\n",
634-
"%watermark -n -u -v -iv -w -p theano,xarray"
634+
"%watermark -n -u -v -iv -w -p aesara,xarray"
635635
]
636636
}
637637
],

examples/diagnostics_and_criticism/Bayes_factor.ipynb

+13-13
Large diffs are not rendered by default.

examples/diagnostics_and_criticism/Diagnosing_biased_Inference_with_Divergences.ipynb

+35-35
Large diffs are not rendered by default.

examples/diagnostics_and_criticism/model_averaging.ipynb

+16-16
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"name": "stdout",
1919
"output_type": "stream",
2020
"text": [
21-
"Runing on PyMC3 v3.11.0\n"
21+
"Runing on PyMC v3.11.0\n"
2222
]
2323
}
2424
],
@@ -27,9 +27,9 @@
2727
"import matplotlib.pyplot as plt\n",
2828
"import numpy as np\n",
2929
"import pandas as pd\n",
30-
"import pymc3 as pm\n",
30+
"import pymc as pm\n",
3131
"\n",
32-
"print(f\"Runing on PyMC3 v{pm.__version__}\")"
32+
"print(f\"Runing on PyMC v{pm.__version__}\")"
3333
]
3434
},
3535
{
@@ -71,7 +71,7 @@
7171
"\n",
7272
"One alternative is to perform model selection but discuss all the different models together with the computed values of a given Information Criterion. It is important to put all these numbers and tests in the context of our problem so that we and our audience can have a better feeling of the possible limitations and shortcomings of our methods. If you are in the academic world you can use this approach to add elements to the discussion section of a paper, presentation, thesis, and so on.\n",
7373
"\n",
74-
"Yet another approach is to perform model averaging. The idea now is to generate a meta-model (and meta-predictions) using a weighted average of the models. There are several ways to do this and PyMC3 includes 3 of them that we are going to briefly discuss, you will find a more thorough explanation in the work by [Yuling Yao et. al.](https://arxiv.org/abs/1704.02030)\n",
74+
"Yet another approach is to perform model averaging. The idea now is to generate a meta-model (and meta-predictions) using a weighted average of the models. There are several ways to do this and PyMC includes 3 of them that we are going to briefly discuss, you will find a more thorough explanation in the work by [Yuling Yao et. al.](https://arxiv.org/abs/1704.02030)\n",
7575
"\n",
7676
"## Pseudo Bayesian model averaging\n",
7777
"\n",
@@ -89,7 +89,7 @@
8989
"\n",
9090
"## Stacking\n",
9191
"\n",
92-
"The third approach implemented in PyMC3 is know as _stacking of predictive distributions_ and it has been recently [proposed](https://arxiv.org/abs/1704.02030). We want to combine several models in a metamodel in order to minimize the diverge between the meta-model and the _true_ generating model, when using a logarithmic scoring rule this is equivalently to:\n",
92+
"The third approach implemented in PyMC is know as _stacking of predictive distributions_ and it has been recently [proposed](https://arxiv.org/abs/1704.02030). We want to combine several models in a metamodel in order to minimize the diverge between the meta-model and the _true_ generating model, when using a logarithmic scoring rule this is equivalently to:\n",
9393
"\n",
9494
"$$\\max_{w} \\frac{1}{n} \\sum_{i=1}^{n}log\\sum_{k=1}^{K} w_k p(y_i|y_{-i}, M_k)$$\n",
9595
"\n",
@@ -99,9 +99,9 @@
9999
"\n",
100100
"## Weighted posterior predictive samples\n",
101101
"\n",
102-
"Once we have computed the weights, using any of the above 3 methods, we can use them to get a weighted posterior predictive samples. PyMC3 offers functions to perform these steps in a simple way, so let see them in action using an example.\n",
102+
"Once we have computed the weights, using any of the above 3 methods, we can use them to get a weighted posterior predictive samples. PyMC offers functions to perform these steps in a simple way, so let see them in action using an example.\n",
103103
"\n",
104-
"The following example is taken from the superb book [Statistical Rethinking](http://xcelab.net/rm/statistical-rethinking/) by Richard McElreath. You will find more PyMC3 examples from this book in this [repository](https://github.com/aloctavodia/Statistical-Rethinking-with-Python-and-PyMC3). We are going to explore a simplified version of it. Check the book for the whole example and a more thorough discussion of both, the biological motivation for this problem and a theoretical/practical discussion of using Information Criteria to compare, select and average models.\n",
104+
"The following example is taken from the superb book [Statistical Rethinking](http://xcelab.net/rm/statistical-rethinking/) by Richard McElreath. You will find more PyMC examples from this book in this [repository](https://github.com/aloctavodia/Statistical-Rethinking-with-Python-and-PyMC). We are going to explore a simplified version of it. Check the book for the whole example and a more thorough discussion of both, the biological motivation for this problem and a theoretical/practical discussion of using Information Criteria to compare, select and average models.\n",
105105
"\n",
106106
"Briefly, our problem is as follows: We want to explore the composition of milk across several primate species, it is hypothesized that females from species of primates with larger brains produce more _nutritious_ milk (loosely speaking this is done _in order to_ support the development of such big brains). This is an important question for evolutionary biologists and try to give and answer we will use 3 variables, two predictor variables: the proportion of neocortex compare to the total mass of the brain and the logarithm of the body mass of the mothers. And for predicted variable, the kilocalories per gram of milk. With these variables we are going to build 3 different linear models:\n",
107107
" \n",
@@ -299,7 +299,7 @@
299299
" mu = alpha + beta * d[\"neocortex\"]\n",
300300
"\n",
301301
" kcal = pm.Normal(\"kcal\", mu=mu, sigma=sigma, observed=d[\"kcal.per.g\"])\n",
302-
" trace_0 = pm.sample(2000, return_inferencedata=True)"
302+
" trace_0 = pm.sample(2000)"
303303
]
304304
},
305305
{
@@ -389,7 +389,7 @@
389389
"\n",
390390
" kcal = pm.Normal(\"kcal\", mu=mu, sigma=sigma, observed=d[\"kcal.per.g\"])\n",
391391
"\n",
392-
" trace_1 = pm.sample(2000, return_inferencedata=True)"
392+
" trace_1 = pm.sample(2000)"
393393
]
394394
},
395395
{
@@ -479,7 +479,7 @@
479479
"\n",
480480
" kcal = pm.Normal(\"kcal\", mu=mu, sigma=sigma, observed=d[\"kcal.per.g\"])\n",
481481
"\n",
482-
" trace_2 = pm.sample(2000, return_inferencedata=True)"
482+
" trace_2 = pm.sample(2000)"
483483
]
484484
},
485485
{
@@ -586,7 +586,7 @@
586586
"tags": []
587587
},
588588
"source": [
589-
"Now that we have sampled the posterior for the 3 models, we are going to use WAIC (Widely applicable information criterion) to compare the 3 models. We can do this using the `compare` function included with PyMC3."
589+
"Now that we have sampled the posterior for the 3 models, we are going to use WAIC (Widely applicable information criterion) to compare the 3 models. We can do this using the `compare` function included with PyMC."
590590
]
591591
},
592592
{
@@ -607,7 +607,7 @@
607607
"name": "stderr",
608608
"output_type": "stream",
609609
"text": [
610-
"/Users/CloudChaoszero/opt/anaconda3/envs/pymc3-dev-py38/lib/python3.8/site-packages/arviz/stats/stats.py:146: UserWarning: The default method used to estimate the weights for each model,has changed from BB-pseudo-BMA to stacking\n",
610+
"/Users/CloudChaoszero/opt/anaconda3/envs/pymc-dev-py38/lib/python3.8/site-packages/arviz/stats/stats.py:146: UserWarning: The default method used to estimate the weights for each model,has changed from BB-pseudo-BMA to stacking\n",
611611
" warnings.warn(\n"
612612
]
613613
},
@@ -724,7 +724,7 @@
724724
"\n",
725725
"We can also see that we get a column with the relative `weight` for each model (according to the first equation at the beginning of this notebook). This weights can be _vaguely_ interpreted as the probability that each model will make the correct predictions on future data. Of course this interpretation is conditional on the models used to compute the weights, if we add or remove models the weights will change. And also is dependent on the assumptions behind WAIC (or any other Information Criterion used). So try to do not overinterpret these `weights`. \n",
726726
"\n",
727-
"Now we are going to use copmuted `weights` to generate predictions based not on a single model but on the weighted set of models. This is one way to perform model averaging. Using PyMC3 we can call the `sample_posterior_predictive_w` function as follows:"
727+
"Now we are going to use copmuted `weights` to generate predictions based not on a single model but on the weighted set of models. This is one way to perform model averaging. Using PyMC we can call the `sample_posterior_predictive_w` function as follows:"
728728
]
729729
},
730730
{
@@ -921,7 +921,7 @@
921921
"Python version : 3.8.6\n",
922922
"IPython version : 7.20.0\n",
923923
"\n",
924-
"pymc3 : 3.11.0\n",
924+
"pymc : 3.11.0\n",
925925
"numpy : 1.20.0\n",
926926
"matplotlib: None\n",
927927
"pandas : 1.2.1\n",
@@ -940,9 +940,9 @@
940940
],
941941
"metadata": {
942942
"kernelspec": {
943-
"display_name": "Python PyMC3 (Dev)",
943+
"display_name": "Python PyMC (Dev)",
944944
"language": "python",
945-
"name": "pymc3-dev-py38"
945+
"name": "pymc-dev-py38"
946946
},
947947
"language_info": {
948948
"codemirror_mode": {

0 commit comments

Comments
 (0)