Skip to content

Commit 20dcbdb

Browse files
authored
Update glm robust with outliers and add extra dependency template (#249)
* bundle of changes * black * black * fix references * some visual improvements to plots * activate codeautolink * fix typo * fix formatting of conclusions * try fixing build * update template and contributing * try reactivating codeautolink * improve extra installs template * address comments * remove GLM robust changes from PR
1 parent 4d140ba commit 20dcbdb

File tree

8 files changed

+674
-742
lines changed

8 files changed

+674
-742
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please let us know if the reviews are unclear or the recommended next step seems
88
if you would like help in addressing a reviewer's comments,
99
or if you have been waiting too long to hear back on your PR. -->
1010

11-
+ [ ] Notebook follows style guide https://github.com/pymc-devs/pymc/wiki/PyMC-Jupyter-Notebook-Style-Guide
11+
+ [ ] Notebook follows style guide https://docs.pymc.io/en/latest/contributing/jupyter_style.html
1212
+ [ ] PR description contains a link to the relevant issue: a tracker one for existing notebooks or a proposal one for new notebooks
1313

1414

CONTRIBUTING.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ Therefore, all notebooks will be progressively updated along this path:
2727

2828
```
2929
/ --> General updates -- \
30-
To Do --< >--> Best Practices (--> v4)
30+
To Do --< >--> Best Practices --> v4
3131
\ --> ArviZ -- /
3232
```
3333

34+
See https://github.com/pymc-devs/pymc-examples/wiki/Notebook-updates-overview for a more detailed
35+
description of what each of the statuses mean.
36+
3437
Each pull request should update a single notebook 1-2 positions to the right.
3538
Before starting a work on a pull request look at the tracker issue of the
3639
notebook you are planning to edit to make sure it is not being updated by someone

examples/conf.py

+11
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
".DS_Store",
3232
"*import_posts*",
3333
"**/.ipynb_checkpoints/*",
34+
"extra_installs.md",
35+
"page_footer.md",
3436
]
3537

3638

@@ -104,13 +106,22 @@
104106
blog_baseurl = "https://examples.pymc.io"
105107
blog_title = "PyMC Examples"
106108
blog_path = "blog"
109+
blog_authors = {
110+
"contributors": ("PyMC Contributors", "https://docs.pymc.io"),
111+
}
112+
blog_default_author = "contributors"
107113
fontawesome_included = True
108114
# post_redirect_refresh = 1
109115
# post_auto_image = 1
110116
# post_auto_excerpt = 2
111117

112118
# MyST config
113119
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath", "substitution"]
120+
myst_substitutions = {
121+
"pip_dependencies": "{{ extra_dependencies }}",
122+
"conda_dependencies": "{{ extra_dependencies }}",
123+
"extra_install_notes": "",
124+
}
114125
jupyter_execute_notebooks = "off"
115126

116127
# bibtex config

examples/extra_installs.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
:::{attention}
2+
This notebook uses libraries that are not PyMC dependencies
3+
and therefore need to be installed specifically to run this notebook.
4+
Open the dropdown below for extra guidance.
5+
:::
6+
7+
::::::{dropdown} Extra dependencies install instructions
8+
:icon: package-dependencies
9+
In order to run this notebook (either locally or on binder) you won't only
10+
need a working PyMC installation with all optional dependencies,
11+
but also to install some extra dependencies.
12+
For advise on installing PyMC itself, please refer to {ref}`pymc:installation`
13+
14+
You can install these dependencies with your preferred package manager, we provide
15+
as an example the pip and conda commands below.
16+
17+
> $ pip install {{ pip_dependencies }}
18+
19+
Note that if you want (or need) to install the packages from inside the notebook instead
20+
of the command line, you can install
21+
the packages by running a variation of the pip command:
22+
23+
> import sys
24+
>
25+
> !{sys.executable} -m pip install {{ pip_dependencies }}
26+
27+
You should not run `!pip install` as it might install the package in a different
28+
environment and not be available from the Jupyter notebook even if installed.
29+
30+
Another alternative is using conda instead:
31+
32+
> $ conda install {{ conda_dependencies }}
33+
34+
when installing scientific python packages with conda,
35+
we recommend using [conda forge](https://conda-forge.org/index.html)
36+
37+
{{ extra_install_notes }}
38+
::::::

examples/generalized_linear_models/GLM-robust-with-outlier-detection.ipynb

+492-654
Large diffs are not rendered by default.

examples/getting_started.ipynb

+3-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@
4141
"source": [
4242
"## Installation\n",
4343
"\n",
44-
"----\n",
45-
"**Note:** These instructions are out of date, and no longer correct. Please see the [Installation instructions](https://github.com/pymc-devs/pymc3#Installation) on the [GitHub site for PyMC3](https://github.com/pymc-devs/pymc3).\n",
46-
"\n",
47-
"----\n",
44+
":::{caution}\n",
45+
"These instructions are out of date, and no longer correct. Please see the [Installation instructions](https://github.com/pymc-devs/pymc3#Installation) on the [GitHub site for PyMC3](https://github.com/pymc-devs/pymc3).\n",
46+
":::\n",
4847
"\n",
4948
"Running PyMC3 requires a working Python interpreter, either version 2.7 (or more recent) or 3.5 (or more recent); we recommend that new users install version 3.5. A complete Python installation for Mac OSX, Linux and Windows can most easily be obtained by downloading and installing the free [`Anaconda Python Distribution`](https://store.continuum.io/cshop/anaconda/) by ContinuumIO. \n",
5049
"\n",

examples/references.bib

+122-79
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
@misc{carpenter2016hierarchical,
2+
title={Hierarchical partial pooling for repeated binary trials},
3+
author={Carpenter, Bob and Gabry, J and Goodrich, B},
4+
year={2016},
5+
publisher={Technical report. Retrieved from https://mc-stan. org/users/docum entat ion~…}
6+
}
7+
8+
@article{efron1975data,
9+
title={Data analysis using Stein's estimator and its generalizations},
10+
author={Efron, Bradley and Morris, Carl},
11+
journal={Journal of the American Statistical Association},
12+
volume={70},
13+
number={350},
14+
pages={311--319},
15+
year={1975},
16+
publisher={Taylor \& Francis}
17+
}
18+
119
@book{gelman2006data,
220
title={Data analysis using regression and multilevel/hierarchical models},
321
author={Gelman, Andrew and Hill, Jennifer},
@@ -16,6 +34,25 @@ @article{gelman2006multilevel
1634
publisher={Taylor \& Francis}
1735
}
1836

37+
@article{gelman2008scaling,
38+
title={Scaling regression inputs by dividing by two standard deviations},
39+
author={Gelman, Andrew},
40+
journal={Statistics in medicine},
41+
volume={27},
42+
number={15},
43+
pages={2865--2873},
44+
year={2008},
45+
publisher={Wiley Online Library},
46+
doi={10.1002/sim.3107}
47+
}
48+
49+
@book{gelman2013bayesian,
50+
title={Bayesian Data Analysis},
51+
publisher={Chapman and Hall/CRC},
52+
author={Gelman, Andrew and Carlin, John B. and Stern, Hal S. and Dunson, David B. and Vehtari, Aki and Rubin, Donald B.},
53+
year={2013}
54+
}
55+
1956
@article{goldberg2001eigentaste,
2057
author = {Ken Goldberg and Theresa Roeder and Chris Perkins},
2158
title = {Eigentaste: A Constant Time Collaborative Filtering Algorithm},
@@ -37,19 +74,47 @@ @misc{harper2015movielens
3774
url={https://doi.org/10.1145/2827872}
3875
}
3976

40-
@article{koren2009matrixfactorization,
41-
author={Koren, Yehuda and Bell, Robert and Volinsky, Chris},
42-
journal={Computer},
43-
title={Matrix Factorization Techniques for Recommender Systems},
44-
year={2009},
45-
volume={42},
46-
number={8},
47-
pages={30--37},
77+
@misc{hogg2010data,
78+
title={Data analysis recipes: Fitting a model to data},
79+
author={David W. Hogg and Jo Bovy and Dustin Lang},
80+
year={2010},
81+
eprint={1008.4686},
82+
archivePrefix={arXiv},
83+
primaryClass={astro-ph.IM}
84+
}
85+
86+
@book{ivezić2014astroMLtext,
87+
author = {Željko Ivezić and Andrew J. Connolly and Jacob T. VanderPlas and Alexander Gray},
88+
doi = {10.1515/9781400848911},
89+
title = {Statistics, Data Mining, and Machine Learning in Astronomy: A Practical Python Guide for the Analysis of Survey Data},
90+
year = {2014},
91+
publisher = {Princeton University Press},
92+
ISBN = {9781400848911}
93+
}
94+
95+
@book{james2021statisticallearning,
96+
title={An Introduction to Statistical Learning},
97+
author={James, Gareth ad Witten, Daniela and Hastie, Trevor and Tibshirani, Robert},
98+
year={2021},
99+
publisher={Springer},
100+
doi={https://doi.org/10.1007/978-1-0716-1418-1},
101+
issn={1431-875X},
102+
isbn={978-1-0716-1420-4}
103+
}
104+
105+
@article{koren2009matrixfactorization,
106+
author={Koren, Yehuda and Bell, Robert and Volinsky, Chris},
107+
journal={Computer},
108+
title={Matrix Factorization Techniques for Recommender Systems},
109+
year={2009},
110+
volume={42},
111+
number={8},
112+
pages={30--37},
48113
doi={10.1109/MC.2009.263}
49114
}
50115

51116
@misc{kingma2014autoencoding,
52-
title={Auto-Encoding Variational Bayes},
117+
title={Auto-Encoding Variational Bayes},
53118
author={Diederik P Kingma and Max Welling},
54119
year={2014},
55120
eprint={1312.6114},
@@ -58,61 +123,14 @@ @misc{kingma2014autoencoding
58123
}
59124

60125
@misc{kucukelbir2015automatic,
61-
title={Automatic Variational Inference in Stan},
126+
title={Automatic Variational Inference in Stan},
62127
author={Alp Kucukelbir and Rajesh Ranganath and Andrew Gelman and David M. Blei},
63128
year={2015},
64129
eprint={1506.03431},
65130
archivePrefix={arXiv},
66131
primaryClass={stat.ML}
67132
}
68133

69-
@book{mcelreath2018statistical,
70-
title={Statistical rethinking: A Bayesian course with examples in R and Stan},
71-
author={McElreath, Richard},
72-
year={2018},
73-
publisher={Chapman and Hall/CRC}
74-
}
75-
76-
@misc{mnih2013playing,
77-
title={Playing Atari with Deep Reinforcement Learning},
78-
author={Volodymyr Mnih and Koray Kavukcuoglu and David Silver and Alex Graves and Ioannis Antonoglou and Daan Wierstra and Martin Riedmiller},
79-
year={2013},
80-
eprint={1312.5602},
81-
archivePrefix={arXiv},
82-
primaryClass={cs.LG}
83-
}
84-
85-
@article{silver2016masteringgo,
86-
title={Mastering the game of Go with deep neural networks and tree search},
87-
author={D. Silver, A. Huang, C. Maddison et al.},
88-
journal={Nature},
89-
volume={529},
90-
pages={484--489},
91-
year={2016},
92-
url={https://doi.org/10.1038/nature16961}
93-
}
94-
95-
@book{james2021statisticallearning,
96-
title={An Introduction to Statistical Learning},
97-
author={James, Gareth ad Witten, Daniela and Hastie, Trevor and Tibshirani, Robert},
98-
year={2021},
99-
publisher={Springer},
100-
doi={https://doi.org/10.1007/978-1-0716-1418-1},
101-
issn={1431-875X},
102-
isbn={978-1-0716-1420-4}
103-
}
104-
105-
@book{wilkinson2005grammar,
106-
title={The Grammar of Graphics},
107-
author={Wilkinson, Leland},
108-
year={2005},
109-
publisher={Springer},
110-
doi={https://doi.org/10.1007/0-387-28695-0},
111-
issn={1431-8784},
112-
isbn={978-0-387-24544-7}
113-
}
114-
115-
116134
@article{lewandowski2009generating,
117135
title={Generating random correlation matrices based on vines and extended onion method},
118136
author={Lewandowski, Daniel and Kurowicka, Dorota and Joe, Harry},
@@ -124,6 +142,13 @@ @article{lewandowski2009generating
124142
publisher={Elsevier}
125143
}
126144

145+
@book{mcelreath2018statistical,
146+
title={Statistical rethinking: A Bayesian course with examples in R and Stan},
147+
author={McElreath, Richard},
148+
year={2018},
149+
publisher={Chapman and Hall/CRC}
150+
}
151+
127152
@inproceedings{mnih2008advances,
128153
title={Probabilistic Matrix Factorization},
129154
author={Mnih, Andriy and Salakhutdinov, Russ R},
@@ -135,6 +160,15 @@ @inproceedings{mnih2008advances
135160
year={2008}
136161
}
137162

163+
@misc{mnih2013playing,
164+
title={Playing Atari with Deep Reinforcement Learning},
165+
author={Volodymyr Mnih and Koray Kavukcuoglu and David Silver and Alex Graves and Ioannis Antonoglou and Daan Wierstra and Martin Riedmiller},
166+
year={2013},
167+
eprint={1312.5602},
168+
archivePrefix={arXiv},
169+
primaryClass={cs.LG}
170+
}
171+
138172
@article{nowlan1992simplifying,
139173
title={Simplifying Neural Networks By Soft Weight-Sharing},
140174
author={Nowlan, Steven J and Hinton, Geoffrey E},
@@ -146,6 +180,7 @@ @article{nowlan1992simplifying
146180
publisher={MIT Press}
147181
}
148182

183+
149184
@inproceedings{salakhutdinov2008bayesian,
150185
title={Bayesian Probabilistic Matrix Factorization Using Markov Chain Monte Carlo},
151186
author={Salakhutdinov, Ruslan and Mnih, Andriy},
@@ -155,35 +190,43 @@ @inproceedings{salakhutdinov2008bayesian
155190
volume={25}
156191
}
157192

193+
@article{silver2016masteringgo,
194+
title={Mastering the game of Go with deep neural networks and tree search},
195+
author={D. Silver, A. Huang, C. Maddison et al.},
196+
journal={Nature},
197+
volume={529},
198+
pages={484--489},
199+
year={2016},
200+
url={https://doi.org/10.1038/nature16961}
201+
}
202+
158203
@misc{szegedy2014going,
159-
title={Going Deeper with Convolutions},
204+
title={Going Deeper with Convolutions},
160205
author={Christian Szegedy and Wei Liu and Yangqing Jia and Pierre Sermanet and Scott Reed and Dragomir Anguelov and Dumitru Erhan and Vincent Vanhoucke and Andrew Rabinovich},
161206
year={2014},
162207
eprint={1409.4842},
163208
archivePrefix={arXiv},
164209
primaryClass={cs.CV}
165210
}
166-
167-
@misc{carpenter2016hierarchical,
168-
title={Hierarchical partial pooling for repeated binary trials},
169-
author={Carpenter, Bob and Gabry, J and Goodrich, B},
170-
year={2016},
171-
publisher={Technical report. Retrieved from https://mc-stan. org/users/docum entat ion~…}
172-
}
173211

174-
@book{gelman2013bayesian,
175-
title={Bayesian Data Analysis},
176-
publisher={Chapman and Hall/CRC},
177-
author={Gelman, Andrew and Carlin, John B. and Stern, Hal S. and Dunson, David B. and Vehtari, Aki and Rubin, Donald B.},
178-
year={2013}
212+
213+
@INPROCEEDINGS{vanderplas2012astroML,
214+
author={{Vanderplas}, J.T. and {Connolly}, A.J.
215+
and {Ivezi{\'c}}, {\v Z}. and {Gray}, A.},
216+
booktitle={Conference on Intelligent Data Understanding (CIDU)},
217+
title={Introduction to astroML: Machine learning for astrophysics},
218+
month={oct.},
219+
pages={47 -54},
220+
doi={10.1109/CIDU.2012.6382200},
221+
year={2012}
179222
}
180-
@article{efron1975data,
181-
title={Data analysis using Stein's estimator and its generalizations},
182-
author={Efron, Bradley and Morris, Carl},
183-
journal={Journal of the American Statistical Association},
184-
volume={70},
185-
number={350},
186-
pages={311--319},
187-
year={1975},
188-
publisher={Taylor \& Francis}
223+
224+
@book{wilkinson2005grammar,
225+
title={The Grammar of Graphics},
226+
author={Wilkinson, Leland},
227+
year={2005},
228+
publisher={Springer},
229+
doi={https://doi.org/10.1007/0-387-28695-0},
230+
issn={1431-8784},
231+
isbn={978-0-387-24544-7}
189232
}

0 commit comments

Comments
 (0)