The graph auto-encoder (GAE) of Kipf and Welling encodes nodes with a two-layer GCN and decodes edges with inner products. A is a symmetric (N, N) 0/1 adjacency matrix without self-loops and X the (N, F) node features. Use the normalised adjacency with the degree matrix of .
gae_encode(A, X, W1, W2): .
gae_logits(Z, pairs): the array of for a list of (i, j) pairs.
gae_loss(A, Z, pos_weight=None): the full reconstruction loss averaged over all entries, with logits and targets , where each positive entry's term is multiplied by pos_weight. If pos_weight is None, use . Compute stably. Return a Python float.
sampled_gae_loss(Z, pos_pairs, neg_pairs): the mean binary cross-entropy over the positive pairs (label 1) and negative pairs (label 0) together.
vgae_sample(mu, logvar, eps): the reparameterised sample .
vgae_kl(mu, logvar): summed over latent dimensions and averaged over nodes (rows), as a Python float.