#!/usr/bin/env python # coding: utf-8 # In[67]: import tensorflow as tf from edward.models import Poisson, Normal # In[78]: nuispar = tf.constant([3.]) x = Poisson(rate = tf.ones(1)*nuispar) n = Normal(loc = nuispar, scale = tf.ones(1)) joined = tf.concat([x,n], axis=0) # p(n, x | nuispar) = Pois(n|nuispar) * Normal(x |mu = nuispar, sigma = 1) # In[79]: results = [] for i in range(1000): #thee is probably a batched evaluation version .. this is stupid with tf.Session() as sess: r = sess.run(joined) results.append(r) # In[80]: get_ipython().run_line_magic('pylab', 'inline') r = np.array(results) f, axarr = plt.subplots(1,3) f.set_size_inches(12,4) axarr[0].scatter(r[:,0],r[:,1]) axarr[1].hist(r[:,0], bins = np.linspace(0,10,11)) axarr[2].hist(r[:,1]) # In[ ]: