Deep-Learning-for-Causal-Inference
Deep-Learning-for-Causal-Inference copied to clipboard
Is the implementation of the function `pdist2sq` corrected?
In the implementation, na
and nb
is not used.
def pdist2sq(A, B):
#helper for PEHEnn
#calculates squared euclidean distance between rows of two matrices
#https://gist.github.com/mbsariyildiz/34cdc26afb630e8cae079048eef91865
# squared norms of each row in A and B
na = tf.reduce_sum(tf.square(A), 1)
nb = tf.reduce_sum(tf.square(B), 1)
# na as a row and nb as a column vectors
na = tf.reshape(na, [-1, 1])
nb = tf.reshape(nb, [1, -1])
# return pairwise euclidean difference matrix
D=tf.reduce_sum((tf.expand_dims(A, 1)-tf.expand_dims(B, 0))**2,2)
return D
Hi Ywandung,
I really appreciate the feedback! I think I've fixed this issue, let me know!
-B