torch_geometric_signed_directed.nn.directed.DGCN_node_classification

Classes

DGCN_node_classification

An implementation of the DGCN node classification model from `Directed Graph Convolutional Network

Module Contents

class DGCN_node_classification(num_features: int, hidden: int, label_dim: int, dropout: float | None = 0.5, improved: bool = False, cached: bool = False)

Bases: torch.nn.Module

An implementation of the DGCN node classification model from Directed Graph Convolutional Network paper.

Parameters:
  • num_features (int) – Dimention of input features.

  • hidden (int) – Hidden dimention.

  • label_dim (int) – Output dimension.

  • dropout (float, optional) – Dropout value. Default: None.

  • improved (bool, optional) – If set to True, the layer computes \(\mathbf{\hat{A}}\) as \(\mathbf{A} + 2\mathbf{I}\). (default: False)

  • cached (bool, optional) – If set to True, the layer will cache the computation of \(\mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2}\) on first execution, and will use the cached version for further executions. This parameter should only be set to True in transductive learning scenarios. (default: False)

dropout = 0.5
dgconv
Conv
lin1
lin2
bias1
bias2
reset_parameters()
forward(x: torch.FloatTensor, edge_index: torch.LongTensor, edge_in: torch.LongTensor, edge_out: torch.LongTensor, in_w: torch.FloatTensor | None = None, out_w: torch.FloatTensor | None = None) torch.FloatTensor

Making a forward pass of the DGCN node classification model.

Arg types:
  • x (PyTorch FloatTensor) - Node features.

  • edge_index (PyTorch LongTensor) - Edge indices.

  • edge_in, edge_out (PyTorch LongTensor) - Edge indices for input and output directions, respectively.

  • in_w, out_w (PyTorch FloatTensor, optional) - Edge weights corresponding to edge indices.

Return types:
  • x (PyTorch FloatTensor) - Logarithmic class probabilities for all nodes, with shape (num_nodes, num_classes).