Skip to content

Search-and-replace a bunch of strings to port to v4. #262

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions examples/case_studies/BEST.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running on PyMC3 v3.11.0\n"
"Running on PyMC v3.11.0\n"
]
}
],
Expand All @@ -25,9 +25,9 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import pymc3 as pm\n",
"import pymc as pm\n",
"\n",
"print(f\"Running on PyMC3 v{pm.__version__}\")"
"print(f\"Running on PyMC v{pm.__version__}\")"
]
},
{
Expand Down Expand Up @@ -222,7 +222,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Since PyMC3 parameterizes the Student-T in terms of precision, rather than standard deviation, we must transform the standard deviations before specifying our likelihoods."
"Since PyMC parameterizes the Student-T in terms of precision, rather than standard deviation, we must transform the standard deviations before specifying our likelihoods."
]
},
{
Expand Down Expand Up @@ -323,7 +323,7 @@
],
"source": [
"with model:\n",
" trace = pm.sample(2000, return_inferencedata=True)"
" trace = pm.sample(2000)"
]
},
{
Expand Down Expand Up @@ -574,7 +574,7 @@
"source": [
"The original pymc2 implementation was written by Andrew Straw and can be found here: https://github.com/strawlab/best\n",
"\n",
"Ported to PyMC3 by [Thomas Wiecki](https://twitter.com/twiecki) (c) 2015, updated by Chris Fonnesbeck."
"Ported to PyMC by [Thomas Wiecki](https://twitter.com/twiecki) (c) 2015, updated by Chris Fonnesbeck."
]
},
{
Expand All @@ -596,7 +596,7 @@
"numpy : 1.19.2\n",
"matplotlib: 3.3.2\n",
"arviz : 0.11.2\n",
"pymc3 : 3.11.0\n",
"pymc : 3.11.0\n",
"\n",
"Watermark: 2.2.0\n",
"\n"
Expand Down
4 changes: 2 additions & 2 deletions examples/case_studies/GHME_2013.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import numpy as np
import pandas as pd

from pymc3 import HalfCauchy, Model, Normal, get_data, sample
from pymc3.distributions.timeseries import GaussianRandomWalk
from pymc import HalfCauchy, Model, Normal, get_data, sample
from pymc.distributions.timeseries import GaussianRandomWalk

data = pd.read_csv(get_data("pancreatitis.csv"))
countries = ["CYP", "DNK", "ESP", "FIN", "GBR", "ISL"]
Expand Down
24 changes: 12 additions & 12 deletions examples/case_studies/LKJ.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/case_studies/baseball.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

import pymc3 as pm
import pymc as pm


def build_model():
Expand Down
34 changes: 17 additions & 17 deletions examples/case_studies/bayesian_ab_testing.ipynb

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions examples/case_studies/binning.ipynb

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions examples/case_studies/blackbox_external_likelihood.ipynb

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions examples/case_studies/blackbox_external_likelihood_numpy.ipynb

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions examples/case_studies/conditional-autoregressive-model.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/case_studies/disaster_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from numpy import arange, array

import pymc3 as pm
import pymc as pm

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

Expand Down
2 changes: 1 addition & 1 deletion examples/case_studies/disaster_model_theano_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from numpy import arange, array, empty
from theano.compile.ops import as_op

import pymc3 as pm
import pymc as pm

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

Expand Down
46 changes: 22 additions & 24 deletions examples/case_studies/factor_analysis.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/case_studies/garch_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import theano.tensor as tt

from arviz import summary
from pymc3 import Model, Normal, Uniform, sample
from pymc import Model, Normal, Uniform, sample

"""
Example from Stan - slightly altered
Expand Down
2 changes: 1 addition & 1 deletion examples/case_studies/gelman_bioassay.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from numpy import array, ones

import pymc3 as pm
import pymc as pm

# Samples for each dose level
n = 5 * ones(4, dtype=int)
Expand Down
2 changes: 1 addition & 1 deletion examples/case_studies/gelman_schools.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

from arviz import loo
from pymc3 import HalfCauchy, Model, Normal, sample
from pymc import HalfCauchy, Model, Normal, sample

"""Original Stan model

Expand Down
18 changes: 9 additions & 9 deletions examples/case_studies/hierarchical_partial_pooling.ipynb

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions examples/case_studies/item_response_nba.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/case_studies/lasso_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from numpy.ma import masked_values

import pymc3 as pm
import pymc as pm

# Import data, filling missing values with sentinels (-999)
test_scores = pd.read_csv(pm.get_data("test_scores.csv")).fillna(-999)
Expand Down
2 changes: 1 addition & 1 deletion examples/case_studies/lightspeed_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import arviz as az
import pymc3 as pm
import pymc as pm

light_speed = np.array(
[
Expand Down
20 changes: 10 additions & 10 deletions examples/case_studies/log-gaussian-cox-process.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions examples/case_studies/mediation_analysis.ipynb

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions examples/case_studies/moderation_analysis.ipynb

Large diffs are not rendered by default.

99 changes: 48 additions & 51 deletions examples/case_studies/multilevel_modeling.ipynb

Large diffs are not rendered by default.

692 changes: 346 additions & 346 deletions examples/case_studies/probabilistic_matrix_factorization.ipynb

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions examples/case_studies/putting_workflow.ipynb

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions examples/case_studies/rugby_analytics.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions examples/case_studies/stochastic_volatility.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import pymc3 as pm\n",
"import pymc as pm\n",
"\n",
"rng = np.random.default_rng(0)\n",
"az.style.use(\"arviz-darkgrid\")"
Expand Down Expand Up @@ -182,7 +182,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Specifying the model in `PyMC3` mirrors its statistical specification. "
"Specifying the model in `PyMC` mirrors its statistical specification. "
]
},
{
Expand Down Expand Up @@ -313,7 +313,7 @@
"outputs": [],
"source": [
"with stochastic_vol_model:\n",
" trace = az.from_pymc3(prior=pm.sample_prior_predictive(500))\n",
" trace = pm.to_inference_data(prior=pm.sample_prior_predictive(500))\n",
"\n",
"prior_predictive = trace.prior_predictive.stack(pooled_chain=(\"chain\", \"draw\"))"
]
Expand Down Expand Up @@ -443,7 +443,7 @@
],
"source": [
"with stochastic_vol_model:\n",
" trace.extend(pm.sample(2000, tune=2000, return_inferencedata=True))\n",
" trace.extend(pm.sample(2000, tune=2000))\n",
"\n",
"posterior = trace.posterior.stack(pooled_chain=(\"chain\", \"draw\"))\n",
"posterior[\"exp_volatility\"] = np.exp(posterior[\"volatility\"])"
Expand Down Expand Up @@ -486,7 +486,7 @@
],
"source": [
"with stochastic_vol_model:\n",
" trace.extend(az.from_pymc3(posterior_predictive=pm.sample_posterior_predictive(trace)))\n",
" trace.extend(pm.to_inference_data(posterior_predictive=pm.sample_posterior_predictive(trace)))\n",
"\n",
"posterior_predictive = trace.posterior_predictive.stack(pooled_chain=(\"chain\", \"draw\"))"
]
Expand Down Expand Up @@ -615,14 +615,14 @@
"Python version : 3.8.5\n",
"IPython version : 7.13.0\n",
"\n",
"theano: 1.1.2\n",
"aesara: 1.1.2\n",
"xarray: 0.17.0\n",
"\n",
"matplotlib: 3.3.4\n",
"pandas : 1.2.1\n",
"arviz : 0.11.2\n",
"numpy : 1.18.5\n",
"pymc3 : 3.11.2\n",
"pymc : 3.11.2\n",
"\n",
"Watermark: 2.2.0\n",
"\n"
Expand All @@ -631,7 +631,7 @@
],
"source": [
"%load_ext watermark\n",
"%watermark -n -u -v -iv -w -p theano,xarray"
"%watermark -n -u -v -iv -w -p aesara,xarray"
]
}
],
Expand Down
26 changes: 13 additions & 13 deletions examples/diagnostics_and_criticism/Bayes_factor.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions examples/diagnostics_and_criticism/model_averaging.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Runing on PyMC3 v3.11.0\n"
"Runing on PyMC v3.11.0\n"
]
}
],
Expand All @@ -27,9 +27,9 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import pymc3 as pm\n",
"import pymc as pm\n",
"\n",
"print(f\"Runing on PyMC3 v{pm.__version__}\")"
"print(f\"Runing on PyMC v{pm.__version__}\")"
]
},
{
Expand Down Expand Up @@ -71,7 +71,7 @@
"\n",
"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",
"\n",
"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",
"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",
"\n",
"## Pseudo Bayesian model averaging\n",
"\n",
Expand All @@ -89,7 +89,7 @@
"\n",
"## Stacking\n",
"\n",
"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",
"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",
"\n",
"$$\\max_{w} \\frac{1}{n} \\sum_{i=1}^{n}log\\sum_{k=1}^{K} w_k p(y_i|y_{-i}, M_k)$$\n",
"\n",
Expand All @@ -99,9 +99,9 @@
"\n",
"## Weighted posterior predictive samples\n",
"\n",
"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",
"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",
"\n",
"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",
"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",
"\n",
"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",
" \n",
Expand Down Expand Up @@ -299,7 +299,7 @@
" mu = alpha + beta * d[\"neocortex\"]\n",
"\n",
" kcal = pm.Normal(\"kcal\", mu=mu, sigma=sigma, observed=d[\"kcal.per.g\"])\n",
" trace_0 = pm.sample(2000, return_inferencedata=True)"
" trace_0 = pm.sample(2000)"
]
},
{
Expand Down Expand Up @@ -389,7 +389,7 @@
"\n",
" kcal = pm.Normal(\"kcal\", mu=mu, sigma=sigma, observed=d[\"kcal.per.g\"])\n",
"\n",
" trace_1 = pm.sample(2000, return_inferencedata=True)"
" trace_1 = pm.sample(2000)"
]
},
{
Expand Down Expand Up @@ -479,7 +479,7 @@
"\n",
" kcal = pm.Normal(\"kcal\", mu=mu, sigma=sigma, observed=d[\"kcal.per.g\"])\n",
"\n",
" trace_2 = pm.sample(2000, return_inferencedata=True)"
" trace_2 = pm.sample(2000)"
]
},
{
Expand Down Expand Up @@ -586,7 +586,7 @@
"tags": []
},
"source": [
"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."
"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."
]
},
{
Expand All @@ -607,7 +607,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/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",
"/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",
" warnings.warn(\n"
]
},
Expand Down Expand Up @@ -724,7 +724,7 @@
"\n",
"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",
"\n",
"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:"
"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:"
]
},
{
Expand Down Expand Up @@ -921,7 +921,7 @@
"Python version : 3.8.6\n",
"IPython version : 7.20.0\n",
"\n",
"pymc3 : 3.11.0\n",
"pymc : 3.11.0\n",
"numpy : 1.20.0\n",
"matplotlib: None\n",
"pandas : 1.2.1\n",
Expand All @@ -940,9 +940,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python PyMC3 (Dev)",
"display_name": "Python PyMC (Dev)",
"language": "python",
"name": "pymc3-dev-py38"
"name": "pymc-dev-py38"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading