Skip to content
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

Update glm robust with outliers and add extra dependency template #249

Merged
merged 14 commits into from
Dec 10, 2021
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Please let us know if the reviews are unclear or the recommended next step seems
if you would like help in addressing a reviewer's comments,
or if you have been waiting too long to hear back on your PR. -->

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


Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ Therefore, all notebooks will be progressively updated along this path:

```
/ --> General updates -- \
To Do --< >--> Best Practices (--> v4)
To Do --< >--> Best Practices --> v4
\ --> ArviZ -- /
```

See https://github.com/pymc-devs/pymc-examples/wiki/Notebook-updates-overview for a more detailed
description of what each of the status mean.
OriolAbril marked this conversation as resolved.
Show resolved Hide resolved

Each pull request should update a single notebook 1-2 positions to the right.
Before starting a work on a pull request look at the tracker issue of the
notebook you are planning to edit to make sure it is not being updated by someone
Expand Down
11 changes: 11 additions & 0 deletions examples/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
".DS_Store",
"*import_posts*",
"**/.ipynb_checkpoints/*",
"extra_installs.md",
"page_footer.md",
]


Expand Down Expand Up @@ -104,13 +106,22 @@
blog_baseurl = "https://examples.pymc.io"
blog_title = "PyMC Examples"
blog_path = "blog"
blog_authors = {
"contributors": ("PyMC Contributors", "https://docs.pymc.io"),
}
blog_default_author = "contributors"
fontawesome_included = True
# post_redirect_refresh = 1
# post_auto_image = 1
# post_auto_excerpt = 2

# MyST config
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath", "substitution"]
myst_substitutions = {
"pip_dependencies": "{{ extra_dependencies }}",
"conda_dependencies": "{{ extra_dependencies }}",
"extra_install_notes": "",
}
jupyter_execute_notebooks = "off"

# bibtex config
Expand Down
38 changes: 38 additions & 0 deletions examples/extra_installs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
:::{attention}
This notebook uses libraries that are not PyMC dependencies
and therefore need to be installed specifically to run this notebook.
Open the dropdown below for extra guidance.
:::

::::::{dropdown} Extra dependencies install instructions
:icon: package-dependencies
In order to run this notebook (either locally or on binder) you won't only
need a working PyMC installation with all optional dependencies,
but also to install some extra dependencies.
For advise on installing PyMC itself, please refer to {ref}`pymc:installation`

You can install these dependencies with your preferred package manager, we provide
as an example the pip and conda commands below.

> $ pip install {{ pip_dependencies }}

Note that if you want (or need) to install the packages from inside the notebook instead
of the command line, you can install
the packages by running a variation of the pip command:

> import sys
>
> !{sys.executable} -m pip install {{ pip_dependencies }}

You should not run `!pip install` as it might install the package in a different
environment and not be available from the Jupyter notebook even if installed.

Another alternative is using conda instead:

> $ conda install {{ conda_dependencies }}

when installing scientific python packages with conda,
we recommend using [conda forge](https://conda-forge.org/index.html)

{{ extra_install_notes }}
::::::
1,146 changes: 492 additions & 654 deletions examples/generalized_linear_models/GLM-robust-with-outlier-detection.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/generalized_linear_models/GLM-robust.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -482,7 +482,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.7"
OriolAbril marked this conversation as resolved.
Show resolved Hide resolved
},
"latex_envs": {
"bibliofile": "biblio.bib",
Expand Down
7 changes: 3 additions & 4 deletions examples/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
"source": [
"## Installation\n",
"\n",
"----\n",
"**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",
"\n",
"----\n",
":::{caution}\n",
"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",
":::\n",
"\n",
"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",
"\n",
Expand Down
201 changes: 122 additions & 79 deletions examples/references.bib
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
@misc{carpenter2016hierarchical,
title={Hierarchical partial pooling for repeated binary trials},
author={Carpenter, Bob and Gabry, J and Goodrich, B},
year={2016},
publisher={Technical report. Retrieved from https://mc-stan. org/users/docum entat ion~…}
}

@article{efron1975data,
title={Data analysis using Stein's estimator and its generalizations},
author={Efron, Bradley and Morris, Carl},
journal={Journal of the American Statistical Association},
volume={70},
number={350},
pages={311--319},
year={1975},
publisher={Taylor \& Francis}
}

@book{gelman2006data,
title={Data analysis using regression and multilevel/hierarchical models},
author={Gelman, Andrew and Hill, Jennifer},
Expand All @@ -16,6 +34,25 @@ @article{gelman2006multilevel
publisher={Taylor \& Francis}
}

@article{gelman2008scaling,
title={Scaling regression inputs by dividing by two standard deviations},
author={Gelman, Andrew},
journal={Statistics in medicine},
volume={27},
number={15},
pages={2865--2873},
year={2008},
publisher={Wiley Online Library},
doi={10.1002/sim.3107}
}

@book{gelman2013bayesian,
title={Bayesian Data Analysis},
publisher={Chapman and Hall/CRC},
author={Gelman, Andrew and Carlin, John B. and Stern, Hal S. and Dunson, David B. and Vehtari, Aki and Rubin, Donald B.},
year={2013}
}

@article{goldberg2001eigentaste,
author = {Ken Goldberg and Theresa Roeder and Chris Perkins},
title = {Eigentaste: A Constant Time Collaborative Filtering Algorithm},
Expand All @@ -37,19 +74,47 @@ @misc{harper2015movielens
url={https://doi.org/10.1145/2827872}
}

@article{koren2009matrixfactorization,
author={Koren, Yehuda and Bell, Robert and Volinsky, Chris},
journal={Computer},
title={Matrix Factorization Techniques for Recommender Systems},
year={2009},
volume={42},
number={8},
pages={30--37},
@misc{hogg2010data,
title={Data analysis recipes: Fitting a model to data},
author={David W. Hogg and Jo Bovy and Dustin Lang},
year={2010},
eprint={1008.4686},
archivePrefix={arXiv},
primaryClass={astro-ph.IM}
}

@book{ivezić2014astroMLtext,
author = {Željko Ivezić and Andrew J. Connolly and Jacob T. VanderPlas and Alexander Gray},
doi = {10.1515/9781400848911},
title = {Statistics, Data Mining, and Machine Learning in Astronomy: A Practical Python Guide for the Analysis of Survey Data},
year = {2014},
publisher = {Princeton University Press},
ISBN = {9781400848911}
}

@book{james2021statisticallearning,
title={An Introduction to Statistical Learning},
author={James, Gareth ad Witten, Daniela and Hastie, Trevor and Tibshirani, Robert},
year={2021},
publisher={Springer},
doi={https://doi.org/10.1007/978-1-0716-1418-1},
issn={1431-875X},
isbn={978-1-0716-1420-4}
}

@article{koren2009matrixfactorization,
author={Koren, Yehuda and Bell, Robert and Volinsky, Chris},
journal={Computer},
title={Matrix Factorization Techniques for Recommender Systems},
year={2009},
volume={42},
number={8},
pages={30--37},
doi={10.1109/MC.2009.263}
}

@misc{kingma2014autoencoding,
title={Auto-Encoding Variational Bayes},
title={Auto-Encoding Variational Bayes},
author={Diederik P Kingma and Max Welling},
year={2014},
eprint={1312.6114},
Expand All @@ -58,61 +123,14 @@ @misc{kingma2014autoencoding
}

@misc{kucukelbir2015automatic,
title={Automatic Variational Inference in Stan},
title={Automatic Variational Inference in Stan},
author={Alp Kucukelbir and Rajesh Ranganath and Andrew Gelman and David M. Blei},
year={2015},
eprint={1506.03431},
archivePrefix={arXiv},
primaryClass={stat.ML}
}

@book{mcelreath2018statistical,
title={Statistical rethinking: A Bayesian course with examples in R and Stan},
author={McElreath, Richard},
year={2018},
publisher={Chapman and Hall/CRC}
}

@misc{mnih2013playing,
title={Playing Atari with Deep Reinforcement Learning},
author={Volodymyr Mnih and Koray Kavukcuoglu and David Silver and Alex Graves and Ioannis Antonoglou and Daan Wierstra and Martin Riedmiller},
year={2013},
eprint={1312.5602},
archivePrefix={arXiv},
primaryClass={cs.LG}
}

@article{silver2016masteringgo,
title={Mastering the game of Go with deep neural networks and tree search},
author={D. Silver, A. Huang, C. Maddison et al.},
journal={Nature},
volume={529},
pages={484--489},
year={2016},
url={https://doi.org/10.1038/nature16961}
}

@book{james2021statisticallearning,
title={An Introduction to Statistical Learning},
author={James, Gareth ad Witten, Daniela and Hastie, Trevor and Tibshirani, Robert},
year={2021},
publisher={Springer},
doi={https://doi.org/10.1007/978-1-0716-1418-1},
issn={1431-875X},
isbn={978-1-0716-1420-4}
}

@book{wilkinson2005grammar,
title={The Grammar of Graphics},
author={Wilkinson, Leland},
year={2005},
publisher={Springer},
doi={https://doi.org/10.1007/0-387-28695-0},
issn={1431-8784},
isbn={978-0-387-24544-7}
}


@article{lewandowski2009generating,
title={Generating random correlation matrices based on vines and extended onion method},
author={Lewandowski, Daniel and Kurowicka, Dorota and Joe, Harry},
Expand All @@ -124,6 +142,13 @@ @article{lewandowski2009generating
publisher={Elsevier}
}

@book{mcelreath2018statistical,
title={Statistical rethinking: A Bayesian course with examples in R and Stan},
author={McElreath, Richard},
year={2018},
publisher={Chapman and Hall/CRC}
}

@inproceedings{mnih2008advances,
title={Probabilistic Matrix Factorization},
author={Mnih, Andriy and Salakhutdinov, Russ R},
Expand All @@ -135,6 +160,15 @@ @inproceedings{mnih2008advances
year={2008}
}

@misc{mnih2013playing,
title={Playing Atari with Deep Reinforcement Learning},
author={Volodymyr Mnih and Koray Kavukcuoglu and David Silver and Alex Graves and Ioannis Antonoglou and Daan Wierstra and Martin Riedmiller},
year={2013},
eprint={1312.5602},
archivePrefix={arXiv},
primaryClass={cs.LG}
}

@article{nowlan1992simplifying,
title={Simplifying Neural Networks By Soft Weight-Sharing},
author={Nowlan, Steven J and Hinton, Geoffrey E},
Expand All @@ -146,6 +180,7 @@ @article{nowlan1992simplifying
publisher={MIT Press}
}


@inproceedings{salakhutdinov2008bayesian,
title={Bayesian Probabilistic Matrix Factorization Using Markov Chain Monte Carlo},
author={Salakhutdinov, Ruslan and Mnih, Andriy},
Expand All @@ -155,35 +190,43 @@ @inproceedings{salakhutdinov2008bayesian
volume={25}
}

@article{silver2016masteringgo,
title={Mastering the game of Go with deep neural networks and tree search},
author={D. Silver, A. Huang, C. Maddison et al.},
journal={Nature},
volume={529},
pages={484--489},
year={2016},
url={https://doi.org/10.1038/nature16961}
}

@misc{szegedy2014going,
title={Going Deeper with Convolutions},
title={Going Deeper with Convolutions},
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},
year={2014},
eprint={1409.4842},
archivePrefix={arXiv},
primaryClass={cs.CV}
}

@misc{carpenter2016hierarchical,
title={Hierarchical partial pooling for repeated binary trials},
author={Carpenter, Bob and Gabry, J and Goodrich, B},
year={2016},
publisher={Technical report. Retrieved from https://mc-stan. org/users/docum entat ion~…}
}

@book{gelman2013bayesian,
title={Bayesian Data Analysis},
publisher={Chapman and Hall/CRC},
author={Gelman, Andrew and Carlin, John B. and Stern, Hal S. and Dunson, David B. and Vehtari, Aki and Rubin, Donald B.},
year={2013}

@INPROCEEDINGS{vanderplas2012astroML,
author={{Vanderplas}, J.T. and {Connolly}, A.J.
and {Ivezi{\'c}}, {\v Z}. and {Gray}, A.},
booktitle={Conference on Intelligent Data Understanding (CIDU)},
title={Introduction to astroML: Machine learning for astrophysics},
month={oct.},
pages={47 -54},
doi={10.1109/CIDU.2012.6382200},
year={2012}
}
@article{efron1975data,
title={Data analysis using Stein's estimator and its generalizations},
author={Efron, Bradley and Morris, Carl},
journal={Journal of the American Statistical Association},
volume={70},
number={350},
pages={311--319},
year={1975},
publisher={Taylor \& Francis}

@book{wilkinson2005grammar,
title={The Grammar of Graphics},
author={Wilkinson, Leland},
year={2005},
publisher={Springer},
doi={https://doi.org/10.1007/0-387-28695-0},
issn={1431-8784},
isbn={978-0-387-24544-7}
}
Loading