google/edward2

AttributeError: module 'edward2.tensorflow' has no attribute 'interception'

sundance91 opened this issue · 0 comments

I am trying to use the deconfounder tutorial by David Blei: https://colab.research.google.com/github/blei-lab/deconfounder_tutorial/blob/master/deconfounder_tutorial.ipynb#scrollTo=DyCfobStxZmE. However, it is written in Tensorflow 1.x (old version of TF) as well as edward2. However, I am trying to get it refactored using Tensorflow 2.14.0 and the most recent version of edward2.

I am on the below cell block:

n_rep = 100 # number of replicated datasets we generate
holdout_gen = np.zeros((n_rep,*(x_train.shape)))

for i in range(n_rep):
b_sample = npr.normal(b_mean_inferred, b_stddv_inferred)
w_sample = npr.normal(w_mean_inferred, w_stddv_inferred)
w2_sample = npr.normal(w2_mean_inferred, w2_stddv_inferred)
z_sample = npr.normal(z_mean_inferred, z_stddv_inferred)

with ed.interception(replace_latents(b_sample, w_sample, w2_sample, z_sample)):
    generate = ppca_model(
        data_dim=data_dim, latent_dim=latent_dim,
        num_datapoints=num_datapoints, stddv_datapoints=stddv_datapoints,
        mask=np.ones(x_train.shape))

with tf.Session() as sess:
    x_generated, _ = sess.run(generate)

# look only at the heldout entries
holdout_gen[i] = np.multiply(x_generated, holdout_mask)

I am getting the below error:

AttributeError: module 'edward2.tensorflow' has no attribute 'interception'

On the ed.interception line. When I look online, it says that this method was taken out of the most recent version of edward2. Does anyone know what the alternative to ed.interception is in the current version of edward2?