code: def test_beta_bernoulli(self):
      with self.test_session() as sess:
          x_data = np.array([0, 1, 0, 0, 0, 0, 0, 0, 0, 1])
  
          p = Beta(1.0, 1.0)
          x = Bernoulli(probs=p, sample_shape=10)
  
          qp = Empirical(tf.Variable(tf.zeros(1000)))
          inference = ed.Gibbs({p: qp}, data={x: x_data})
          inference.run()
  
          true_posterior = Beta(3.0, 9.0)
  
          val_est, val_true = sess.run(
              [qp.mean(), true_posterior.mean()]
          )
          self.assertAllClose(val_est, val_true, rtol=1e-2, atol=1e-2)
  
          val_est, val_true = sess.run(
              [qp.variance(), true_posterior.variance()]
          )
          self.assertAllClose(val_est, val_true, rtol=1e-2, atol=1e-2)
  
file_path: edward/tests/inferences/gibbs_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import edward
  import numpy
  import tensorflow
  from edward.models import Bernoulli, Beta, Empirical, Normal
label_desc: Use image node_id 2 for calling the test_gibbs_class obj's underlying member method code with example usage: obj.test_beta_bernoulli() without return types