code: def main(_):
      ed.set_seed(42)
      N = 5000  # number of data points
      D = 10  # number of features
  
      # DATA
      w_true = np.random.randn(D)
      X_data = np.random.randn(N, D)
      p = expit(np.dot(X_data, w_true))
      y_data = np.array([np.random.binomial(1, i) for i in p])
  
      # MODEL
      X = tf.placeholder(tf.float32, [N, D])
      w = Normal(loc=tf.zeros(D), scale=tf.ones(D))
      y = Bernoulli(logits=ed.dot(X, w))
  
      # INFERENCE
      qw = Normal(
          loc=tf.get_variable("qw/loc", [D]),
          scale=tf.nn.softplus(tf.get_variable("qw/scale", [D])),
      )
  
      inference = IWVI({w: qw}, data={X: X_data, y: y_data})
      inference.run(K=5, n_iter=1000)
  
      # CRITICISM
      print(
          "Mean squared error in true values to inferred posterior mean:"
      )
      print(tf.reduce_mean(tf.square(w_true - qw.mean())).eval())
  
file_path: edward/examples/iwvi.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import edward
  import numpy
  import six
  import tensorflow
  from edward.inferences import VariationalInference
  from edward.models import Bernoulli, Normal, RandomVariable
  from edward.util import copy
  from scipy.special import expit
label_desc: Use image node_id 2 for calling a global function with example usage: main(_) without return types