torch_geometric_signed_directed.nn.signed.SGCN

Classes

SGCN

The signed graph convolutional network model from the `"Signed Graph

Module Contents

class SGCN(node_num: int, edge_index_s: torch.LongTensor, in_dim: int = 64, out_dim: int = 64, layer_num: int = 2, init_emb: torch.FloatTensor = None, init_emb_grad: bool = False, lamb: float = 5, norm_emb: bool = False, **kwargs)

Bases: torch.nn.Module

The signed graph convolutional network model from the “Signed Graph Convolutional Network” paper. Internally, the first part of this module uses the torch_geometric.nn.conv.SignedConv operator. We have made some modifications to the original model torch_geometric.nn.SignedGCN for the uniformity of model inputs.

Parameters:
  • node_num (int) – The number of nodes.

  • edge_index_s (LongTensor) – The edgelist with sign. (e.g., torch.LongTensor([[0, 1, -1], [0, 2, 1]]) )

  • in_dim (int, optional) – Size of each input sample features. Defaults to 64.

  • out_dim (int, optional) – Size of each output embeddings. Defaults to 64.

  • layer_num (int, optional) – Number of layers. Defaults to 2.

  • init_emb – (FloatTensor, optional): The initial embeddings. Defaults to None, which will use TSVD as initial embeddings.

  • init_emb_grad (bool optional) – Whether to set the initial embeddings to be trainable. (default: False)

  • lamb (float, optional) – Balances the contributions of the overall objective. (default: 5)

  • norm_emb (bool, optional) – Whether to normalize embeddings. (default: False)

node_num
in_dim = 64
out_dim = 64
lamb = 5
device
pos_edge_index
neg_edge_index
x
conv1
convs
lsp_loss
structure_loss
reset_parameters()
loss() torch.FloatTensor
forward() torch.Tensor