Jupyter Notebooks 📓 by Naereen @ GitHub
This repository hosts some Jupyter Notebooks, covering various subjects.
- At the beginning, this repository was only here to host some small experiments, for me to learn how to use the wonderful Jupyter tools correctly (baby notebooks 🍼);
- Some notebooks are small tutorials, on 🐚
bash
commands (or some of my command-line my scripts) (as example #1), or on 🐍 Python (as example #2); - Some notebooks are written in French 🇫🇷, mainly documents written for the preparation to the highly competitive French national exam to become a professor (aka the "agrégation"), as in 2016-17 I am a teaching assistant at ENS de Rennes in the Computer Science department, for the "Fundamental Computer Science" minor option (D) for the agrégation exam. (🇫🇷 Voir ce sous-dossier | 🇬🇧 See this sub-folder ).
- I also wrote some notebooks on numerical simulations of dice games (🇫🇷 Voir ce sous-dossier | 🇬🇧 See this sub-folder).
- This notebook shows a hand-written and clear implementation of several Pseudo-Random Number Generators, including the famous Mersenne twister algorithm, and then uses it to samples from the most famous discrete and continuous distributions, showcasing use of the Inverse-Transform method and Acceptance-Rejection method (cf. Markov Chain Monte-Carlo methods).
- This notebook written for the Pi Day 2017 demonstrates a dozen of algorithms to compute digits of the number pi.
- This other notebook shows some "obfuscated" code, producing ✨ nice figures... Or maybe they are pieces of code art 🎨 ?
- I will try to write more artistic notebooks, showcasing nice pieces of code 🎨!
- 🇫🇷 Ce notebook en français présente les problèmes de bandits multi-bras stochastiques (multi-armed bandit, MAB), et les algorithmes dits "de bandits" pour les résoudre (UCB "Upper Confidence Bounds", Thompson Sampling, Approximated Finite-Horizon Gittins index etc).
- This notebook shows a hand-written and clear implementation of several Hashing functions, like
MD5
,SHA1
, etc. (not 100% finished yet) - This small notebook is a stupid experiment, where I tried to use James Powell (@duct) rwatch module to write a Python context manager to add a Gaussian white noise to every numbers inside the context... Something like:
with noise(): x = 10
will producex = 10.325
for instance... It fails, but I almost got it, and it works (without breaking the interpreter) for complex numbers. That's already intersting! - And more will come... soon!
1. How to read these documents?
1.a. View the notebooks statically 📝
- Either directly in GitHub: see the list of notebooks;
- Or on nbviewer.jupiter.org: list of notebooks.
1.b. Play with the notebooks dynamically 💥
Anyone can use the mybinder.org website (by clicking on the icon above) to run the notebook in her/his web-browser. You can then play with it as long as you like, for instance by modifying the values or experimenting with the code.
2. Requirements to run the notebooks locally?
All the requirements can be installed with pip
and by running a few python -m ...
commands.
Note: if you use Python 3 instead of Python 2, you might have to replace
pip
andpython
bypip3
andpython3
in the next commands (if both pip and pip3 are installed).
Jupyter Notebook and IPython
2.a.sudo pip install jupyter ipython
It will also install all the dependencies, afterward you should have a jupyter-notebook
command (or a jupyter
command, to be ran as jupyter notebook
) available in your PATH
:
$ whereis jupyter-notebook
jupyter-notebook: /usr/local/bin/jupyter-notebook
$ jupyter-notebook --version # version >= 4 is recommended
4.2.1
2.b. Other kernels (optional):
They are only needed to run the notebooks written for Bash or Octave (or OCaml):
GNU Bash kernel
2.b.1.- You have to have
bash
installed (already there on all Linux distribution, installable withbrew
ormacports
on Mac OS, available on Windows throughcygwin
):
$ bash --version | head -n1
GNU bash, version 4.3.42(1)-release (x86_64-pc-linux-gnu)
- And then install the kernel
bash_kernel
with these two commands:
sudo pip install bash_kernel
python -m bash_kernel.install
GNU Octave kernel
2.b.2.- You have to have
octave
installed (installable with the package manager on major Linux distributions (apt-get
,pacman
,yum
etc), installable withbrew
ormacports
on Mac OS, available on Windows throughcygwin
or natively):
$ octave --version | head -n1
GNU Octave, version 4.0.0
- Your version of Octave should be installed with gnuplot support (it is usually the case):
$ gnuplot --version | head -n1
gnuplot 5.0 patchlevel 1
- And then install the kernel
bash_kernel
with these two commands:
sudo pip install octave_kernel
python -m octave_kernel.install
OCaml kernel
2.b.3.The instructions are not so simple, cf. the tutorial by @andrewray on iocaml's wiki.
💁 More information?
- More information about notebooks (on the documentation of IPython) or on the FAQ on Jupyter's website.
- More information about mybinder.org: on this example repository.
📜 License ?
All the notebooks in this repository are published under the terms of the MIT License (file LICENSE.txt). © Lilian Besson, 2016-17.