Created
October 21, 2016 15:53
-
-
Save fonnesbeck/bdcf94cc162cf4b76b39822cdb411a25 to your computer and use it in GitHub Desktop.
Untitled.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nimport theano.tensor as tt\nimport pymc3 as pm", | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": "WARNING (theano.gof.compilelock): Overriding existing lock by dead process '24325' (I am process '1577')\n", | |
"name": "stderr" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "with pm.Model() as model:\n \n β = pm.Normal('β', 0.5, sd=1000, shape=2)\n \n # Initialize a tensor of zeros, and replace all but one with the variables\n betas = tt.set_subtensor(tt.zeros(shape=3)[1:], β)\n ", | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "betas.tag.test_value", | |
"execution_count": 6, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([ 0. , 0.5, 0.5])" | |
}, | |
"metadata": {}, | |
"execution_count": 6 | |
} | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python [default]", | |
"language": "python" | |
}, | |
"anaconda-cloud": {}, | |
"latex_envs": { | |
"eqNumInitial": 0, | |
"eqLabelWithNumbers": true, | |
"current_citInitial": 1, | |
"cite_by": "apalike", | |
"bibliofile": "biblio.bib" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"nbconvert_exporter": "python", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"pygments_lexer": "ipython3", | |
"file_extension": ".py", | |
"version": "3.5.2" | |
}, | |
"gist": { | |
"id": "", | |
"data": { | |
"description": "Untitled.ipynb", | |
"public": true | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment