torch_geometric_signed_directed.nn.signed.SSSNET_node_clustering

Classes

SSSNET_node_clustering

The signed graph clustering model from the

Module Contents

class SSSNET_node_clustering(nfeat: int, hidden: int, nclass: int, dropout: float, hop: int, fill_value: float, directed: bool = False, bias: bool = True)

Bases: torch.nn.Module

The signed graph clustering model from the SSSNET: Semi-Supervised Signed Network Clustering paper.

Parameters:
  • nfeat (int) – Number of features.

  • hidden (int) – Hidden dimensions of the initial MLP.

  • nclass (int) – Number of clusters.

  • dropout (float) – Dropout probability.

  • 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)

  • bias (bool, optional) – If set to False, the layer will not learn an additive bias. (default: True)

forward(edge_index_p: torch.LongTensor, edge_weight_p: torch.FloatTensor, edge_index_n: torch.LongTensor, edge_weight_n: torch.FloatTensor, features: torch.FloatTensor) Tuple[torch.FloatTensor, torch.FloatTensor, torch.LongTensor, torch.FloatTensor]

Making a forward pass of the SSSNET.

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.

  • features (PyTorch FloatTensor) - Input node features, with shape (num_nodes, num_features).

Return types:
  • z (PyTorch FloatTensor) - Embedding matrix, with shape (num_nodes, 2*hidden) for undirected graphs and (num_nodes, 4*hidden) for directed graphs.

  • output (PyTorch FloatTensor) - Log of prob, with shape (num_nodes, num_clusters).

  • predictions_cluster (PyTorch LongTensor) - Predicted labels.

  • prob (PyTorch FloatTensor) - Probability assignment matrix of different clusters, with shape (num_nodes, num_clusters).