torch_geometric_signed_directed.nn.directed.MagNet_node_classification
Classes
The MagNet model for node classification from the |
Module Contents
- class MagNet_node_classification(num_features: int, hidden: int = 2, q: float = 0.25, K: int = 1, label_dim: int = 2, activation: bool = False, trainable_q: bool = False, layer: int = 2, dropout: float = False, normalization: str = 'sym', cached: bool = False)
Bases:
torch.nn.ModuleThe MagNet model for node classification from the MagNet: A Neural Network for Directed Graphs. paper.
- Parameters:
num_features (int) – Size of each input sample.
hidden (int, optional) – Number of hidden channels. Default: 2.
K (int, optional) – Order of the Chebyshev polynomial, i.e., Chebyshev filter size minus 1 \(K\). Default: 1.
q (float, optional) – Initial value of the phase parameter, 0 <= q <= 0.25. Default: 0.25.
label_dim (int, optional) – Number of output classes. Default: 2.
activation (bool, optional) – whether to use activation function or not. (default:
False)trainable_q (bool, optional) – whether to set q to be trainable or not. (default:
False)layer (int, optional) – Number of MagNetConv layers. Deafult: 2.
dropout (float, optional) – Dropout value. (default:
False)normalization (str, optional) – The normalization scheme for the magnetic Laplacian (default:
sym): 1.None: No normalization \(\mathbf{L} = \mathbf{D} - \mathbf{A} \odot \exp(i \Theta^{(q)})\) 2."sym": Symmetric normalization \(\mathbf{L} = \mathbf{I} - \mathbf{D}^{-1/2} \mathbf{A} \mathbf{D}^{-1/2} \odot \exp(i \Theta^{(q)})\) odot denotes the element-wise multiplication.cached (bool, optional) – If set to
True, the layer will cache the __norm__ matrix on first execution, and will use the cached version for further executions. This parameter should only be set toTruein transductive learning scenarios. (default:False)
- normalization = 'sym'
- activation = False
- Chebs
- Conv
- dropout = False
- reset_parameters()
- forward(real: torch.FloatTensor, imag: torch.FloatTensor, edge_index: torch.LongTensor, edge_weight: torch.LongTensor | None = None) torch.FloatTensor
Making a forward pass of the MagNet node classification model.
- Arg types:
real, imag (PyTorch Float Tensor) - Node features.
edge_index (PyTorch Long Tensor) - Edge indices.
edge_weight (PyTorch Float Tensor, optional) - Edge weights corresponding to edge indices.
- Return types:
log_prob (PyTorch Float Tensor) - Logarithmic class probabilities for all nodes, with shape (num_nodes, num_classes).