# Cannot correctly setup model for Gibbs inference

**URL:** <https://discourse.edwardlib.org/t/cannot-correctly-setup-model-for-gibbs-inference/536>\
**Category:** General\
**Created:** [December 12, 2017, 1:55pm UTC](https://discourse.edwardlib.org/t/cannot-correctly-setup-model-for-gibbs-inference/536 "2017-12-12T13:55:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icesmith](https://avatars.discourse-cdn.com/v4/letter/i/eada6e/32.png) [@icesmith](https://discourse.edwardlib.org/u/icesmith)\
**Post date:** [December 12, 2017, 1:55pm UTC](https://discourse.edwardlib.org/t/cannot-correctly-setup-model-for-gibbs-inference/536/1 "2017-12-12T13:55:28Z")

</div>

I created a simple model where runny nose probability depends on cold disease, but the model doesn’t work correctly for some reason, evaluated cold probability doesn’t depend on passed runny nose data.

```
import edward as ed
import tensorflow as tf
from edward.models import (
	Beta,
	Bernoulli,
	Empirical
)

N = 100

cold_p = Beta(.01, 1.0)
cold = Bernoulli(probs=cold_p)

runny_nose_p_a = tf.cond(tf.cast(cold, tf.bool), lambda: tf.constant(5.0), lambda: tf.constant(.01))
runny_nose_p = Beta(runny_nose_p_a, 1.0)
runny_nose = Bernoulli(probs=runny_nose_p)

q_cold_p = Empirical(params=tf.Variable(tf.zeros(N)))
q_cold = Empirical(params=tf.Variable(tf.zeros(N, dtype=tf.int32)))

q_runny_nose_p = Empirical(params=tf.Variable(tf.zeros(N)))

laten_vars = {cold_p: q_cold_p, cold: q_cold, runny_nose_p: q_runny_nose_p}
inference = ed.Gibbs(laten_vars, data={runny_nose: 1})
inference.run()

mean = q_cold_p.mean().eval()
print("mean: " + str(mean))
```
