Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import math\n",
"\n",
"import torch\n",
"import torch.distributions.constraints as constraints\n",
"\n",
"import pyro\n",
"from pyro.optim import Adam\n",
"from pyro.infer import SVI, Trace_ELBO\n",
"import pyro.distributions as dist\n",
"\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def model(data):\n",
" # set prior\n",
" alpha0 = torch.tensor(5.0)\n",
" beta0 = torch.tensor(5.0)\n",
" prior = dist.Beta(alpha0, beta0)\n",
"\n",
" # sample z from the prior\n",
" z = pyro.sample(\"z\", prior)\n",
"\n",
" with pyro.plate(\"data_plate\"): \n",
" # observe data\n",
" pyro.sample(\"obs\", dist.Bernoulli(z), obs=data)\n",
"\n",
"def posterior():\n",
" alpha_q = pyro.param(\"alpha_q\", torch.tensor(15.0),\n",
" constraint=constraints.positive)\n",
" beta_q = pyro.param(\"beta_q\", torch.tensor(15.0),\n",
" constraint=constraints.positive)\n",
"\n",
" return dist.Beta(alpha_q, beta_q)\n",
"\n",
"def guide(data):\n",
" # sample z from the posterior\n",
" pyro.sample(\"z\", posterior())"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def append_data(data):\n",
" for _ in range(6):\n",
" data.append(1.0)\n",
" for _ in range(4):\n",
" data.append(0.0)\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"....................mean: 0.557, std: 0.093\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0c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Qkm/YefvV\nq557yed/LMnbd16/MsnJVc89x/P/niSvT/LIHu+/Psk9SSrJG5I8OO8ZrLjPzczbAHT3fd39hZ03\nH8j29e/7xdTbIPxaktuT/M8yh1uCKef/E0ne3d3/lSTdfWrJMy7SlPPvJF+78/rXJfmPJc63UN19\nPMlnX+KQtyb5w972QJKvr6rXzHMG4T43u90G4NKXOP7WbP8NvF/MPP+dfx5e3t378fn8Uz7/r0vy\nuqr6u6p6oKquW9p0izfl/H85yS1V9VS2r0j7qeWM9rJwtn04a+7HvWBVdUuSjSTfu+pZlqWqXpHk\nXUnetuJRVunCbG+XfF+2/7V1vKq+vbufXelUy3Nzkvd0929U1RuT/FFVXdXdX171YPuBFfe5mXQb\ngKr6gSS/mOTG7v7ikmZbhlnnf0mSq5LcX1Uns73Pd9c++gbllM//U0nu6u4vdfe/JvnnbId8P5hy\n/rcmeX+SdPdHk7wy2/fxOAgm9eF8CPe5mXkbgKq6OsnvZDva+2l/M5lx/t39ue4+1N3r3b2e7T3+\nG7t7czXjzt2U20D8ZbZX26mqQ9neOnlymUMu0JTz/1SS70+Sqvq2bId7a6lTrs5dSX5s5+qSNyT5\nXHd/ep4fwFbJOeg9bgNQVb+aZLO770ry60leleTPqipJPtXdN65s6DmaeP771sTz/3CSt1TVY0le\nSPJz3f2Z1U09PxPP/51Jfreqfibb36h8W+9ccjG6qnpftv9SPrSzh/9LSS5Kku7+7Wzv6V+f5Ikk\nX0jy43OfYZ/8XgIcGLZKAAYj3ACDEW6AwQg3wGCEG2Awwg0wGOEGGIxwAwzm/wBMGHrwju0VqgAA\nAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"....................mean: 0.569, std: 0.089\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nA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Jbk/yda6517x5//VSR5M8k2zt1+57rlX\nvP6jSd42e/2yJMfXPfcC1/99SV6b5OE93n9NkruSVJLXJXlg0TM44z47X7kNQHf/X5IXbgPwFd19\nT3d/Yfbm/dm5/n2/mLv+mV9PcmuS/13lcCswZf0/leTd3f3fSdLdJ1Y84zJNWX8n+frZ69+Q5D9X\nON9Sdfd9ST57mkPekuSPesf9Sb6xql61yBmE++zsdhuAi09z/E3Z+Rt4v5i7/tk/Dy/t7v34fP4p\nn//XJHlNVf19Vd1fVVevbLrlm7L+X0lyY1U9mZ0r0n5mNaO9JJxpH86YHxa8ZFV1Y5KtJN+/7llW\npapeluRdSd665lHW6fzsbJf8QHb+tXVfVX1ndz+z1qlW54Yk7+nu36qq1yf546q6vLu/vO7B9gNn\n3Gdn0m0AquqHkvxSkuu6+4srmm0V5q3/oiSXJ7m3qo5nZ5/vjn30Dcopn/8nk9zR3V/q7n9L8i/Z\nCfl+MGX9NyV5f5J090eTvDw79/E4CCb14VwI99mZexuAqroiye9lJ9r7aX8zmbP+7v5cdx/q7s3u\n3szOHv913b29nnEXbsptIP4qO2fbqapD2dk6eWKVQy7RlPV/KskPJklVfUd2wn1ypVOuzx1JfmJ2\ndcnrknyuuz+9yA9gq+Qs9B63AaiqX0uy3d13JPnNJK9I8udVlSSf6u7r1jb0Ak1c/741cf0fTvKm\nqno0yfNJfr67P7O+qRdn4vrfmeT3q+rnsvONyrf27JKL0VXV+7Lzl/Kh2R7+Lye5IEm6+3ezs6d/\nTZLHk3whyU8ufIZ98nsJcGDYKgEYjHADDEa4AQYj3ACDEW6AwQg3wGCEG2Awwg0wmP8HHqNzQKVY\n24cAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"....................mean: 0.573, std: 0.087\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05z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/SLtvyT51iQX\nJ/lEkiued8ybknzt7PHbk/zpuude5fpnx12S5J4k9ybZWvfcK/74vzrJ/Um+cfb6K9Y994rXfyLJ\n22ePr0hyat1zL3D935PkdUke3Oft1ya5I0kleX2S+xY9gzPuc/OV2wB09/8mee42AF/R3Xd19xdn\nr96b3evfD4q565/5tSTvSvI/qxxuBaas/yeSvKe7/ytJuvv0imdcpinr7yRfP3v8DUn+Y4XzLVV3\n35Pksy9wyFuT/GHvujfJy6vqlYucQbjPzdneBuCm7P4NfFDMXf/sn4eXdfdBvJnKlI//a5K8pqr+\nrqruraprVjbd8k1Z/y8nubGqHs/uFWk/tZrRXhSWfpsQ9+Nesqq6MclWku9d9yyrUlUvSfLuJG9b\n8yjrdGF2t0u+L7v/2rqnqr6juz+31qlW54Yk7+3u36iqNyT5o6p6bXd/ed2DHQTOuM/NpNsAVNUP\nJPnFJNd195dWNNsqzFv/JUlem+TuqjqV3X2+2w7QFyinfPwfT3Jbd/9fd/9rkn/ObsgPginrvynJ\nB5Kkuz+W5KXZvY/HYTCpD+dDuM/N3NsAVNWVSX4nu9E+SPubyZz1d/fnu/tId29292Z29/iv6+7t\n9Yy7cFNuA/GX2T3bTlUdye7WyWOrHHKJpqz/00m+P0mq6tuzG+6dlU65Prcl+bHZ1SWvT/L57n5y\nke/AVsk56H1uA1BVv5pku7tvS/LrSV6W5M+qKkk+3d3XrW3oBZq4/gNr4vo/kuTNVfVwkmeT/Fx3\nf2Z9Uy/OxPW/M8nvVtXPZPcLlW/r2SUXo6uq92f3L+Ujsz38X0pyUZJ0929nd0//2iSPJvlikh9f\n+AwH5PcS4NCwVQIwGOEGGIxwAwxGuAEGI9wAgxFugMEIN8BghBtgMP8Pkx9qGtCANBIAAAAASUVO\nRK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"....................mean: 0.573, std: 0.086\n"
]
},
{
"data": {
"image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qOllVD+/z8aqq35r93jxUVa9Z+BDd7e0M37L7Tdp/\nSvLNSS5M8okkl592zBuSfPXs8VuT/Mm6517l+mfHXZTkviT3J9la99wr/vq/KsmDSb5+9v4r1j33\nitd/LMlbZ48vT3Ji3XMvcP3fneQ1SR7e5+PXJrkrSSV5bZIHFj2DM+6zM/c2AN19T3d/afbu/dm9\n/v2gmHobhF9N8o4k/7XK4VZgyvp/PMm7uvs/kqS7T654xmWasv5O8rWzx1+X5N9WON9Sdfd9ST73\nAoe8Ockf9K77k7y8ql65yBmE++zsdRuAi1/g+Juz+zfwQTF3/bN/Hl7a3Qfx9oVTvv6vTvLqqvrb\nqrp/dofNg2LK+n8pyU1V9WR2r0j7ydWM9qJwpn04Y36QwpJV1U1JtpJ8z7pnWZWqekmSdyZ5y5pH\nWafzs7td8r3Z/dfWfVX1bd39+bVOtTo3JnlPd/96Vb0uyR9W1RXd/b/rHuwgcMZ9dibdBqCqvj/J\nLyS5vru/vKLZVmHe+i9KckWSe6vqRHb3+e44QN+gnPL1fzLJHd39P939z0n+MbshPwimrP/mJO9P\nku7+aJKXZvc+HofBpD6cC+E+O3NvA1BVVyb5nexG+yDtbyZz1t/dX+juI9292d2b2d3jv767t9cz\n7sJNuQ3EX2T3bDtVdSS7WydPrHLIJZqy/k8n+b4kqapvzW64d1Y65frckeRHZ1eXvDbJF7r7M4v8\nBLZKzkLvcxuAqvqVJNvdfUeSX0vysiR/WlVJ8unuvn5tQy/QxPUfWBPX/+Ekb6yqR5M8l+Rnu/uz\n65t6cSau/+1Jfreqfjq736h8S88uuRhdVb0vu38pH5nt4f9ikguSpLt/O7t7+tcmeTzJl5L82MJn\nOCC/lwCHhq0SgMEIN8BghBtgMMINMBjhBhiMcAMMRrgBBiPcAIP5P3SQdV0W/1aLAAAAAElFTkSu\nQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"....................mean: 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4fuHYdcy5DVd1SVaeq6sF9Pl5V9VuzP5sHqupVCx+iu93O8pbdH9L+U5JvT3Jxkk8m\neeUZ27wuydfP7r81yZ+ue+5V7v9su0uS3J3kniRb6557xV//lye5P8k3zx6/ZN1zr3j/jyd56+z+\nK5OcXPfcC9z/70vyqiQP7vPxa5PcnqSSvDrJvYuewRH3uZl7GYDuvrO7vzx7eE92z38/KKZeBuHX\nkrwjyX+tcrgVmLL/P5HkXd39H0nS3adWPOMyTdn/TvKNs/vflOTfVjjfUnX33Uk+/xybvCnJe3rX\nPUleXFUvXeQMwn1uzvYyADdl92/gg2Lu/s/+eXhZdx/Eq2BN+fq/IskrqurvquqeqrpmZdMt35T9\n/+UkN1bV49k9I+2nVjPa88LSLxPijRSWrKpuTLKV5PvXPcuqVNULkrwzyVvWPMo6XZjd5ZIfyO6/\ntu6uqu/q7i+sdarVeXOSd3f3b1TVa5L8UVVd0d1fXfdgB4Ej7nMz6TIAVfVDSX4xyfXd/ZUVzbYK\n8/b/kiRXJLmrqk5md53vxAH6AeWUr//jSU509/909z8n+cfshvwgmLL/NyV5f5J090eTvDC71/E4\nDCb14XwI97mZexmAqroyye9mN9oHaX0zmbP/3f3F7j7S3ZvdvZndNf7ru3t7PeMu3JTLQPxldo+2\nU1VHsrt08tgqh1yiKfv/mSQ/mCRV9Z3ZDffOSqdcnxNJfmx2dsmrk3yxuz+7yE9gqeQc9D6XAaiq\nX02y3d0nkvx6khcl+bOqSpLPdPf1axt6gSbu/4E1cf8/nOQNVfVwkmeS/Fx3f259Uy/OxP1/e5Lf\nq6qfye4PKt/Ss1MuRldV78vuX8pHZmv4v5TkoiTp7t/J7pr+tUkeTfLlJD++8BkOyJ8lwKFhqQRg\nMMINMBjhBhiMcAMMRrgBBiPcAIMRboDBCDfAYP4XDxh3IoAiopIAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"n_steps = 2000\n",
"\n",
"pyro.set_rng_seed(101)\n",
"\n",
"data = []\n",
"\n",
"for _ in range(5):\n",
" pyro.clear_param_store()\n",
" append_data(data)\n",
" # setup the optimizer\n",
" adam_params = {\"lr\": 0.001, \"betas\": (0.90, 0.999)}\n",
" optimizer = Adam(adam_params)\n",
"\n",
" # setup the inference algorithm\n",
" svi = SVI(model, guide, optimizer, loss=Trace_ELBO())\n",
"\n",
" # do gradient steps\n",
" for step in range(n_steps):\n",
" svi.step(torch.tensor(data))\n",
" if step % 100 == 0:\n",
" print('.', end='')\n",
"\n",
" inferred_mean = posterior().mean\n",
" inferred_std = math.sqrt(posterior().variance)\n",
"\n",
" print(\"mean: %.3f, std: %.3f\"% (inferred_mean, inferred_std) )\n",
" \n",
" plt.hist([posterior().sample() for _ in range(1000)], bins=20, range=(0.05,1), density=True)\n",
" plt.plot([0.6, 0.6], [0, 5])\n",
" plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.