google / google/edward2

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

Open
#582 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
712
Forks
77
Avg merge
9h 39m
Merged PRs (30d)
1

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.