torch_geometric_signed_directed.nn.signed.SIMPA
Classes
The signed mixed-path aggregation model from the |
Module Contents
- class SIMPA(hop: int, fill_value: float, directed: bool = False)
Bases:
torch.nn.ModuleThe signed mixed-path aggregation model from the SSSNET: Semi-Supervised Signed Network Clustering paper.
- Parameters:
hop (int) – Number of hops to consider.
fill_value (float) – Value for added self-loops for the positive part of the adjacency matrix.
directed (bool, optional) – Whether the input network is directed or not. (default:
False)
- conv_layer_p
- conv_layer_n
- forward(edge_index_p: torch.LongTensor, edge_weight_p: torch.FloatTensor, edge_index_n: torch.LongTensor, edge_weight_n: torch.FloatTensor, x_p: torch.FloatTensor, x_n: torch.FloatTensor, x_pt: torch.FloatTensor | None = None, x_nt: torch.FloatTensor | None = None) Tuple[torch.FloatTensor, torch.FloatTensor, torch.LongTensor, torch.FloatTensor]
Making a forward pass of SIMPA.
- Arg types:
edge_index_p, edge_index_n (PyTorch FloatTensor) - Edge indices for positive and negative parts.
edge_weight_p, edge_weight_n (PyTorch FloatTensor) - Edge weights for positive and nagative parts.
x_p (PyTorch FloatTensor) - Souce positive hidden representations.
x_n (PyTorch FloatTensor) - Souce negative hidden representations.
x_pt (PyTorch FloatTensor, optional) - Target positive hidden representations. Default: None.
x_nt (PyTorch FloatTensor, optional) - Target negative hidden representations. Default: None.
- Return types:
feat (PyTorch FloatTensor) - Embedding matrix, with shape (num_nodes, 2*input_dim) for undirected graphs and (num_nodes, 4*input_dim) for directed graphs.