- class GeomGCN(*args: Any, **kwargs: Any)
Bases:
MessagePassing
The graph convolutional operator from the “GEOM-GCN: GEOMETRIC GRAPH CONVOLUTIONAL NETWORKS” paper
\[\textbf{e}_{(i,r)}^{v,l+1} = \sum_{u \in N_{i}(v)} \delta(\tau(z_v,z_u),r)(deg(v)deg(u))^{\frac{1}{2}} \textbf{h}_u^l, \forall i \in {g,s}, \forall r \in R \]\[\textbf{h}_v^{l+1}=\sigma(W_l \cdot \mathbin\Vert_{i\in \{g,s\}} \mathbin\Vert_{r \in R} \textbf{e}_{(i,r)}^{v,l+1}) \]where \(\textbf{e}_{(i,r)}^{v,l+1}\) is a virtual vertex, recieved by summing up representations \(\textbf{h}_u^l\) of nodes on layer l in structural neighbourhoods \(i=s\) and graph neighbourhood \(i=g\) separately for each neighbors with relation \(r\) from the set of relations \(R\). \(z_v\) is an embedding of nodes in latent space, \(deg(v)\) is a degree of node \(v\)
- Parameters:
in_channels – (int): Size of each input sample.
out_channels – (int): Size of each output sample.
data – (Graph): Input dataset
last_layer – (bool): When true, the virtual vertices are summed, otherwise – concatenated.
embeddings – (NDArray): array of node unsupervised embeddings
- forward(x: torch.Tensor, edge_index: torch.Tensor) numpy.typing.NDArray
Modify representations, convolutional layer
- Parameters:
x – (Tensor): Representations of nodes
edge_index – (Tensor): Edges of input graph
- Returns:
Hidden representation of nodes on the next layer
- message(x_j: torch.Tensor, norm: torch.Tensor) torch.Tensor
Count message from the neighbour
- Parameters:
(Tensor) (norm) – Representation of the node neighbour
(Tensor) – Normalization term
- Returns:
(Tensor): Message from the neighbor
- reset_parameters() None
Reset parameters