Path: blob/master/notebooks/book1/02/centralLimitDemo.ipynb
1193 views
Kernel: Python 3
Central Limit Theorem
In [2]:
Out[2]:
Collecting git+https://github.com/probml/probml-utils.git
Cloning https://github.com/probml/probml-utils.git to /tmp/pip-req-build-mc62jfr2
Running command git clone -q https://github.com/probml/probml-utils.git /tmp/pip-req-build-mc62jfr2
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: firebase-admin in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (4.4.0)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (1.0.2)
Requirement already satisfied: graphviz in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (0.10.1)
Requirement already satisfied: jaxlib in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (0.3.7+cuda11.cudnn805)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (3.2.2)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (1.21.6)
Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (1.4.1)
Collecting TexSoup
Downloading TexSoup-0.3.1.tar.gz (26 kB)
Requirement already satisfied: jax in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (0.3.8)
Requirement already satisfied: regex in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (2019.12.20)
Collecting distrax
Downloading distrax-0.1.2-py3-none-any.whl (272 kB)
|████████████████████████████████| 272 kB 15.7 MB/s
Requirement already satisfied: jupyter in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (1.0.0)
Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from probml-utils==0.1.dev50+g413eabd) (1.3.5)
Requirement already satisfied: absl-py>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from distrax->probml-utils==0.1.dev50+g413eabd) (1.0.0)
Requirement already satisfied: tensorflow-probability>=0.15.0 in /usr/local/lib/python3.7/dist-packages (from distrax->probml-utils==0.1.dev50+g413eabd) (0.16.0)
Collecting chex>=0.0.7
Downloading chex-0.1.3-py3-none-any.whl (72 kB)
|████████████████████████████████| 72 kB 344 kB/s
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.9.0->distrax->probml-utils==0.1.dev50+g413eabd) (1.15.0)
Requirement already satisfied: dm-tree>=0.1.5 in /usr/local/lib/python3.7/dist-packages (from chex>=0.0.7->distrax->probml-utils==0.1.dev50+g413eabd) (0.1.7)
Requirement already satisfied: toolz>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from chex>=0.0.7->distrax->probml-utils==0.1.dev50+g413eabd) (0.11.2)
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from jax->probml-utils==0.1.dev50+g413eabd) (4.2.0)
Requirement already satisfied: opt-einsum in /usr/local/lib/python3.7/dist-packages (from jax->probml-utils==0.1.dev50+g413eabd) (3.3.0)
Requirement already satisfied: flatbuffers<3.0,>=1.12 in /usr/local/lib/python3.7/dist-packages (from jaxlib->probml-utils==0.1.dev50+g413eabd) (2.0)
Requirement already satisfied: gast>=0.3.2 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability>=0.15.0->distrax->probml-utils==0.1.dev50+g413eabd) (0.5.3)
Requirement already satisfied: cloudpickle>=1.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability>=0.15.0->distrax->probml-utils==0.1.dev50+g413eabd) (1.3.0)
Requirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability>=0.15.0->distrax->probml-utils==0.1.dev50+g413eabd) (4.4.2)
Requirement already satisfied: cachecontrol>=0.12.6 in /usr/local/lib/python3.7/dist-packages (from firebase-admin->probml-utils==0.1.dev50+g413eabd) (0.12.11)
Requirement already satisfied: google-api-core[grpc]<2.0.0dev,>=1.14.0 in /usr/local/lib/python3.7/dist-packages (from firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.31.5)
Requirement already satisfied: google-api-python-client>=1.7.8 in /usr/local/lib/python3.7/dist-packages (from firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.12.11)
Requirement already satisfied: google-cloud-firestore>=1.4.0 in /usr/local/lib/python3.7/dist-packages (from firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.7.0)
Requirement already satisfied: google-cloud-storage>=1.18.0 in /usr/local/lib/python3.7/dist-packages (from firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.18.1)
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from cachecontrol>=0.12.6->firebase-admin->probml-utils==0.1.dev50+g413eabd) (2.23.0)
Requirement already satisfied: msgpack>=0.5.2 in /usr/local/lib/python3.7/dist-packages (from cachecontrol>=0.12.6->firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.0.3)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.56.0)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (2022.1)
Requirement already satisfied: google-auth<2.0dev,>=1.25.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.35.0)
Requirement already satisfied: packaging>=14.3 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (21.3)
Requirement already satisfied: setuptools>=40.3.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (57.4.0)
Requirement already satisfied: protobuf>=3.12.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (3.17.3)
Requirement already satisfied: grpcio<2.0dev,>=1.29.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.44.0)
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin->probml-utils==0.1.dev50+g413eabd) (3.0.1)
Requirement already satisfied: google-auth-httplib2>=0.0.3 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin->probml-utils==0.1.dev50+g413eabd) (0.0.4)
Requirement already satisfied: httplib2<1dev,>=0.15.0 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin->probml-utils==0.1.dev50+g413eabd) (0.17.4)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (0.2.8)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (4.2.4)
Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (4.8)
Requirement already satisfied: google-cloud-core<2.0dev,>=1.0.3 in /usr/local/lib/python3.7/dist-packages (from google-cloud-firestore>=1.4.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.0.3)
Requirement already satisfied: google-resumable-media<0.5.0dev,>=0.3.1 in /usr/local/lib/python3.7/dist-packages (from google-cloud-storage>=1.18.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (0.4.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=14.3->google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (3.0.8)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->firebase-admin->probml-utils==0.1.dev50+g413eabd) (0.4.8)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->cachecontrol>=0.12.6->firebase-admin->probml-utils==0.1.dev50+g413eabd) (2021.10.8)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->cachecontrol>=0.12.6->firebase-admin->probml-utils==0.1.dev50+g413eabd) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->cachecontrol>=0.12.6->firebase-admin->probml-utils==0.1.dev50+g413eabd) (1.24.3)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->cachecontrol>=0.12.6->firebase-admin->probml-utils==0.1.dev50+g413eabd) (2.10)
Requirement already satisfied: qtconsole in /usr/local/lib/python3.7/dist-packages (from jupyter->probml-utils==0.1.dev50+g413eabd) (5.3.0)
Requirement already satisfied: jupyter-console in /usr/local/lib/python3.7/dist-packages (from jupyter->probml-utils==0.1.dev50+g413eabd) (5.2.0)
Requirement already satisfied: nbconvert in /usr/local/lib/python3.7/dist-packages (from jupyter->probml-utils==0.1.dev50+g413eabd) (5.6.1)
Requirement already satisfied: ipykernel in /usr/local/lib/python3.7/dist-packages (from jupyter->probml-utils==0.1.dev50+g413eabd) (4.10.1)
Requirement already satisfied: ipywidgets in /usr/local/lib/python3.7/dist-packages (from jupyter->probml-utils==0.1.dev50+g413eabd) (7.7.0)
Requirement already satisfied: notebook in /usr/local/lib/python3.7/dist-packages (from jupyter->probml-utils==0.1.dev50+g413eabd) (5.3.1)
Requirement already satisfied: traitlets>=4.1.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (5.1.1)
Requirement already satisfied: jupyter-client in /usr/local/lib/python3.7/dist-packages (from ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (5.3.5)
Requirement already satisfied: ipython>=4.0.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (5.5.0)
Requirement already satisfied: tornado>=4.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (5.1.1)
Requirement already satisfied: pickleshare in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (0.7.5)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (1.0.18)
Requirement already satisfied: pexpect in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (4.8.0)
Requirement already satisfied: pygments in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (2.6.1)
Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (0.8.1)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.7/dist-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython>=4.0.0->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (0.2.5)
Requirement already satisfied: widgetsnbextension~=3.6.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (3.6.0)
Requirement already satisfied: nbformat>=4.2.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (5.3.0)
Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (1.1.0)
Requirement already satisfied: ipython-genutils~=0.2.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (0.2.0)
Requirement already satisfied: jupyter-core in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (4.10.0)
Requirement already satisfied: jsonschema>=2.6 in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (4.3.3)
Requirement already satisfied: fastjsonschema in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (2.15.3)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from jsonschema>=2.6->nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (4.11.3)
Requirement already satisfied: importlib-resources>=1.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema>=2.6->nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (5.7.1)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema>=2.6->nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (0.18.1)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema>=2.6->nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (21.4.0)
Requirement already satisfied: zipp>=3.1.0 in /usr/local/lib/python3.7/dist-packages (from importlib-resources>=1.4.0->jsonschema>=2.6->nbformat>=4.2.0->ipywidgets->jupyter->probml-utils==0.1.dev50+g413eabd) (3.8.0)
Requirement already satisfied: terminado>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from notebook->jupyter->probml-utils==0.1.dev50+g413eabd) (0.13.3)
Requirement already satisfied: Send2Trash in /usr/local/lib/python3.7/dist-packages (from notebook->jupyter->probml-utils==0.1.dev50+g413eabd) (1.8.0)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.7/dist-packages (from notebook->jupyter->probml-utils==0.1.dev50+g413eabd) (2.11.3)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from jupyter-client->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (2.8.2)
Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.7/dist-packages (from jupyter-client->ipykernel->jupyter->probml-utils==0.1.dev50+g413eabd) (22.3.0)
Requirement already satisfied: ptyprocess in /usr/local/lib/python3.7/dist-packages (from terminado>=0.8.1->notebook->jupyter->probml-utils==0.1.dev50+g413eabd) (0.7.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from jinja2->notebook->jupyter->probml-utils==0.1.dev50+g413eabd) (2.0.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->probml-utils==0.1.dev50+g413eabd) (1.4.2)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->probml-utils==0.1.dev50+g413eabd) (0.11.0)
Requirement already satisfied: testpath in /usr/local/lib/python3.7/dist-packages (from nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (0.6.0)
Requirement already satisfied: entrypoints>=0.2.2 in /usr/local/lib/python3.7/dist-packages (from nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (0.4)
Requirement already satisfied: defusedxml in /usr/local/lib/python3.7/dist-packages (from nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (0.7.1)
Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (0.8.4)
Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (1.5.0)
Requirement already satisfied: bleach in /usr/local/lib/python3.7/dist-packages (from nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (5.0.0)
Requirement already satisfied: webencodings in /usr/local/lib/python3.7/dist-packages (from bleach->nbconvert->jupyter->probml-utils==0.1.dev50+g413eabd) (0.5.1)
Requirement already satisfied: qtpy>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from qtconsole->jupyter->probml-utils==0.1.dev50+g413eabd) (2.1.0)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->probml-utils==0.1.dev50+g413eabd) (1.1.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->probml-utils==0.1.dev50+g413eabd) (3.1.0)
Building wheels for collected packages: probml-utils, TexSoup
Building wheel for probml-utils (PEP 517) ... done
Created wheel for probml-utils: filename=probml_utils-0.1.dev50+g413eabd-py3-none-any.whl size=32388 sha256=7d971f89bcad6016fa525354edc055e38e504fd922fef529a08b385ce550b943
Stored in directory: /tmp/pip-ephem-wheel-cache-1yzf0ubu/wheels/37/8f/cb/b845cd5de3d7f648717815f9c27bec49975bf58637a97fa6be
Building wheel for TexSoup (setup.py) ... done
Created wheel for TexSoup: filename=TexSoup-0.3.1-py3-none-any.whl size=27666 sha256=4cf8e84ec26bebd40c8cb0eeafcf255daf31bd3bcacfca4a600e07a6b2e79726
Stored in directory: /root/.cache/pip/wheels/2b/8e/c6/7ee3f9f9776fd18c0ccb04492902ed42225b6dfab3c68f14c0
Successfully built probml-utils TexSoup
Installing collected packages: chex, TexSoup, distrax, probml-utils
Successfully installed TexSoup-0.3.1 chex-0.1.3 distrax-0.1.2 probml-utils-0.1.dev50+g413eabd
In [3]:
Out[3]:
/usr/local/lib/python3.7/dist-packages/probml_utils/plotting.py:26: UserWarning: LATEXIFY environment variable not set, not latexifying
warnings.warn("LATEXIFY environment variable not set, not latexifying")
In [4]:
In [14]:
In [15]:
In [16]:
Out[16]:
/usr/local/lib/python3.7/dist-packages/probml_utils/plotting.py:79: UserWarning: set FIG_DIR environment variable to save figures
warnings.warn("set FIG_DIR environment variable to save figures")
In [ ]:
In [ ]: