nichecompass.nn.CosineSimGraphDecoder
- class nichecompass.nn.CosineSimGraphDecoder(dropout_rate=0.0)
Cosine similarity graph decoder class.
Takes the concatenated latent feature vectors z of the source and target nodes as input, and calculates the element-wise cosine similarity between source and target nodes to return the reconstructed edge logits.
The sigmoid activation function to compute reconstructed edge probabilities is integrated into the binary cross entropy loss for computational efficiency.
- Parameters:
dropout_rate (
float(default:0.0)) – Probability of nodes to be dropped during training.
Methods table
|
Forward pass of the cosine similarity graph decoder. |
Methods
- CosineSimGraphDecoder.forward(z)
Forward pass of the cosine similarity graph decoder.
- Parameters:
z (
Tensor) – Concatenated latent feature vector of the source and target nodes (dim: 4 * edge_batch_size x n_gps due to negative edges).- Return type:
Tensor- Returns:
edge_recon_logits: Reconstructed edge logits (dim: 2 * edge_batch_size due to negative edges).