Skip to content

Commit 8274b91

Browse files
Update NBs prior to 3.9.0 release (#3955)
* Re-run and fix many notebooks... Co-authored-by: Michael Osthege <[email protected]>
1 parent cfa56a4 commit 8274b91

File tree

74 files changed

+11986
-5609
lines changed

Some content is hidden

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

74 files changed

+11986
-5609
lines changed

docs/source/notebooks/AR.ipynb

Lines changed: 33 additions & 33 deletions
Large diffs are not rendered by default.

docs/source/notebooks/BEST.ipynb

Lines changed: 237 additions & 78 deletions
Large diffs are not rendered by default.

docs/source/notebooks/Bayes_factor.ipynb

Lines changed: 58 additions & 16 deletions
Large diffs are not rendered by default.

docs/source/notebooks/DEMetropolisZ_EfficiencyComparison.ipynb

Lines changed: 886 additions & 979 deletions
Large diffs are not rendered by default.

docs/source/notebooks/DEMetropolisZ_tune_drop_fraction.ipynb

Lines changed: 641 additions & 714 deletions
Large diffs are not rendered by default.

docs/source/notebooks/Diagnosing_biased_Inference_with_Divergences.ipynb

Lines changed: 1017 additions & 470 deletions
Large diffs are not rendered by default.

docs/source/notebooks/Euler-Maruyama_and_SDEs.ipynb

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,24 @@
4242
],
4343
"source": [
4444
"%pylab inline\n",
45+
"import arviz as az\n",
4546
"import pymc3 as pm\n",
46-
"import theano.tensor as tt \n",
4747
"import scipy\n",
48+
"import theano.tensor as tt\n",
49+
"\n",
4850
"from pymc3.distributions.timeseries import EulerMaruyama"
4951
]
5052
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": null,
56+
"metadata": {},
57+
"outputs": [],
58+
"source": [
59+
"%config InlineBackend.figure_format = 'retina'\n",
60+
"az.style.use('arviz-darkgrid')"
61+
]
62+
},
5163
{
5264
"cell_type": "markdown",
5365
"metadata": {
@@ -751,6 +763,31 @@
751763
"plot(zs, 'r', label='$z(t)$')\n",
752764
"legend()"
753765
]
766+
},
767+
{
768+
"cell_type": "code",
769+
"execution_count": 10,
770+
"metadata": {},
771+
"outputs": [
772+
{
773+
"name": "stdout",
774+
"output_type": "stream",
775+
"text": [
776+
"pymc3 3.8\n",
777+
"arviz 0.8.3\n",
778+
"numpy 1.17.5\n",
779+
"last updated: Thu Jun 11 2020 \n",
780+
"\n",
781+
"CPython 3.8.2\n",
782+
"IPython 7.11.0\n",
783+
"watermark 2.0.2\n"
784+
]
785+
}
786+
],
787+
"source": [
788+
"%load_ext watermark\n",
789+
"%watermark -n -u -v -iv -w"
790+
]
754791
}
755792
],
756793
"metadata": {
@@ -770,7 +807,7 @@
770807
"name": "python",
771808
"nbconvert_exporter": "python",
772809
"pygments_lexer": "ipython3",
773-
"version": "3.6.7"
810+
"version": "3.8.2"
774811
},
775812
"latex_envs": {
776813
"bibliofile": "biblio.bib",
@@ -1600,5 +1637,5 @@
16001637
}
16011638
},
16021639
"nbformat": 4,
1603-
"nbformat_minor": 1
1640+
"nbformat_minor": 4
16041641
}

docs/source/notebooks/GLM-hierarchical-advi-minibatch.ipynb

Lines changed: 149 additions & 39 deletions
Large diffs are not rendered by default.

docs/source/notebooks/GLM-hierarchical-binominal-model.ipynb

Lines changed: 146 additions & 46 deletions
Large diffs are not rendered by default.

docs/source/notebooks/GLM-hierarchical.ipynb

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,32 @@
5252
"metadata": {},
5353
"outputs": [],
5454
"source": [
55-
"%matplotlib inline\n",
55+
"import arviz as az\n",
5656
"import matplotlib.pyplot as plt\n",
5757
"import numpy as np\n",
58-
"import pymc3 as pm \n",
5958
"import pandas as pd\n",
59+
"import pymc3 as pm \n",
6060
"import theano\n",
6161
"\n",
62+
"print('Running on PyMC3 v{}'.format(pm.__version__))"
63+
]
64+
},
65+
{
66+
"cell_type": "code",
67+
"execution_count": null,
68+
"metadata": {},
69+
"outputs": [],
70+
"source": [
71+
"%config InlineBackend.figure_format = 'retina'\n",
72+
"az.style.use('arviz-darkgrid')"
73+
]
74+
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": null,
78+
"metadata": {},
79+
"outputs": [],
80+
"source": [
6281
"data = pd.read_csv(pm.get_data('radon.csv'))\n",
6382
"data['log_radon'] = data['log_radon'].astype(theano.config.floatX)\n",
6483
"county_names = data.county.unique()\n",
@@ -553,6 +572,31 @@
553572
"### Acknowledgements\n",
554573
"Thanks to [Imri Sofer](http://serre-lab.clps.brown.edu/person/imri-sofer/) for feedback and teaching us about the connections to random-effects models and [Dan Dillon](http://cdasr.mclean.harvard.edu/index.php/about-us/current-lab-members/14-faculty/62-daniel-dillon) for useful comments on an earlier draft."
555574
]
575+
},
576+
{
577+
"cell_type": "code",
578+
"execution_count": 10,
579+
"metadata": {},
580+
"outputs": [
581+
{
582+
"name": "stdout",
583+
"output_type": "stream",
584+
"text": [
585+
"pymc3 3.8\n",
586+
"arviz 0.8.3\n",
587+
"numpy 1.17.5\n",
588+
"last updated: Thu Jun 11 2020 \n",
589+
"\n",
590+
"CPython 3.8.2\n",
591+
"IPython 7.11.0\n",
592+
"watermark 2.0.2\n"
593+
]
594+
}
595+
],
596+
"source": [
597+
"%load_ext watermark\n",
598+
"%watermark -n -u -v -iv -w"
599+
]
556600
}
557601
],
558602
"metadata": {
@@ -572,7 +616,7 @@
572616
"name": "python",
573617
"nbconvert_exporter": "python",
574618
"pygments_lexer": "ipython3",
575-
"version": "3.6.5"
619+
"version": "3.8.2"
576620
},
577621
"latex_envs": {
578622
"bibliofile": "biblio.bib",
@@ -583,5 +627,5 @@
583627
}
584628
},
585629
"nbformat": 4,
586-
"nbformat_minor": 2
630+
"nbformat_minor": 4
587631
}

docs/source/notebooks/GLM-linear.ipynb

Lines changed: 163 additions & 32 deletions
Large diffs are not rendered by default.

docs/source/notebooks/GLM-logistic.ipynb

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,33 @@
2121
"metadata": {},
2222
"outputs": [],
2323
"source": [
24-
"%matplotlib inline\n",
25-
"import pandas as pd\n",
24+
"import arviz as az\n",
25+
"import matplotlib.pyplot as plt\n",
2626
"import numpy as np\n",
27+
"import pandas as pd\n",
2728
"import pymc3 as pm\n",
28-
"import matplotlib.pyplot as plt\n",
2929
"import seaborn\n",
30+
"import theano as thno\n",
31+
"import theano.tensor as T\n",
3032
"import warnings\n",
31-
"warnings.filterwarnings('ignore')\n",
32-
"from collections import OrderedDict\n",
33-
"from time import time\n",
34-
"\n",
35-
"import numpy as np\n",
36-
"import pandas as pd\n",
37-
"import matplotlib.pyplot as plt\n",
3833
"\n",
34+
"from collections import OrderedDict\n",
3935
"from scipy.optimize import fmin_powell\n",
4036
"from scipy import integrate\n",
37+
"from time import time\n",
4138
"\n",
42-
"import theano as thno\n",
43-
"import theano.tensor as T"
39+
"print('Running on PyMC3 v{}'.format(pm.__version__))"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": [
48+
"%config InlineBackend.figure_format = 'retina'\n",
49+
"warnings.filterwarnings('ignore')\n",
50+
"az.style.use('arviz-darkgrid')"
4451
]
4552
},
4653
{
@@ -420,9 +427,7 @@
420427
{
421428
"cell_type": "code",
422429
"execution_count": 6,
423-
"metadata": {
424-
"scrolled": false
425-
},
430+
"metadata": {},
426431
"outputs": [
427432
{
428433
"data": {
@@ -952,9 +957,7 @@
952957
},
953958
{
954959
"cell_type": "markdown",
955-
"metadata": {
956-
"collapsed": true
957-
},
960+
"metadata": {},
958961
"source": [
959962
"## Model selection \n",
960963
"\n",
@@ -1066,12 +1069,35 @@
10661069
},
10671070
{
10681071
"cell_type": "markdown",
1069-
"metadata": {
1070-
"collapsed": true
1071-
},
1072+
"metadata": {},
10721073
"source": [
10731074
"WAIC confirms our decision to use age^2. "
10741075
]
1076+
},
1077+
{
1078+
"cell_type": "code",
1079+
"execution_count": 10,
1080+
"metadata": {},
1081+
"outputs": [
1082+
{
1083+
"name": "stdout",
1084+
"output_type": "stream",
1085+
"text": [
1086+
"pymc3 3.8\n",
1087+
"arviz 0.8.3\n",
1088+
"numpy 1.17.5\n",
1089+
"last updated: Thu Jun 11 2020 \n",
1090+
"\n",
1091+
"CPython 3.8.2\n",
1092+
"IPython 7.11.0\n",
1093+
"watermark 2.0.2\n"
1094+
]
1095+
}
1096+
],
1097+
"source": [
1098+
"%load_ext watermark\n",
1099+
"%watermark -n -u -v -iv -w"
1100+
]
10751101
}
10761102
],
10771103
"metadata": {
@@ -1091,7 +1117,7 @@
10911117
"name": "python",
10921118
"nbconvert_exporter": "python",
10931119
"pygments_lexer": "ipython3",
1094-
"version": "3.6.7"
1120+
"version": "3.8.2"
10951121
},
10961122
"latex_envs": {
10971123
"bibliofile": "biblio.bib",
@@ -1102,5 +1128,5 @@
11021128
}
11031129
},
11041130
"nbformat": 4,
1105-
"nbformat_minor": 1
1131+
"nbformat_minor": 4
11061132
}

docs/source/notebooks/GLM-model-selection.ipynb

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,27 @@
2121
}
2222
],
2323
"source": [
24-
"%matplotlib inline\n",
25-
"import pymc3 as pm\n",
24+
"import arviz as az\n",
25+
"import matplotlib.pyplot as plt\n",
2626
"import numpy as np\n",
2727
"import pandas as pd\n",
28-
"import matplotlib.pyplot as plt\n",
28+
"import pymc3 as pm\n",
2929
"import seaborn as sns\n",
30+
"\n",
3031
"from collections import OrderedDict\n",
3132
"from ipywidgets import interactive, fixed\n",
3233
"\n",
33-
"plt.style.use('seaborn-darkgrid')\n",
34-
"print('Running on PyMC3 v{}'.format(pm.__version__))\n",
34+
"print('Running on PyMC3 v{}'.format(pm.__version__))"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"%config InlineBackend.figure_format = 'retina'\n",
44+
"az.style.use('arviz-darkgrid')\n",
3545
"rndst = np.random.RandomState(0)"
3646
]
3747
},
@@ -1541,6 +1551,31 @@
15411551
"source": [
15421552
"Example originally contributed by Jonathan Sedar 2016-01-09 [github.com/jonsedar](https://github.com/jonsedar). Edited by Junpeng Lao 2017-07-6 [github.com/junpenglao](https://github.com/junpenglao)"
15431553
]
1554+
},
1555+
{
1556+
"cell_type": "code",
1557+
"execution_count": 10,
1558+
"metadata": {},
1559+
"outputs": [
1560+
{
1561+
"name": "stdout",
1562+
"output_type": "stream",
1563+
"text": [
1564+
"pymc3 3.8\n",
1565+
"arviz 0.8.3\n",
1566+
"numpy 1.17.5\n",
1567+
"last updated: Thu Jun 11 2020 \n",
1568+
"\n",
1569+
"CPython 3.8.2\n",
1570+
"IPython 7.11.0\n",
1571+
"watermark 2.0.2\n"
1572+
]
1573+
}
1574+
],
1575+
"source": [
1576+
"%load_ext watermark\n",
1577+
"%watermark -n -u -v -iv -w"
1578+
]
15441579
}
15451580
],
15461581
"metadata": {
@@ -1560,7 +1595,7 @@
15601595
"name": "python",
15611596
"nbconvert_exporter": "python",
15621597
"pygments_lexer": "ipython3",
1563-
"version": "3.6.5"
1598+
"version": "3.8.2"
15641599
},
15651600
"widgets": {
15661601
"state": {
@@ -1583,5 +1618,5 @@
15831618
}
15841619
},
15851620
"nbformat": 4,
1586-
"nbformat_minor": 2
1621+
"nbformat_minor": 4
15871622
}

0 commit comments

Comments
 (0)