torch_geometric_signed_directed.nn.general.conv_base
Classes
The base class for mixed-path aggregation model, a convolution sub-model, from the |
Functions
|
Module Contents
- conv_norm_rw(edge_index, fill_value=0.5, edge_weight=None, num_nodes=None, add_self_loops=True, dtype=None)
- class Conv_Base(fill_value: float = 0.5, cached: bool = False, add_self_loops: bool = True, normalize: bool = True, **kwargs)
Bases:
torch_geometric.nn.conv.MessagePassingThe base class for mixed-path aggregation model, a convolution sub-model, from the DIGRAC: Digraph Clustering Based on Flow Imbalance paper. .. math:
\mathbf{X}^{\prime} = \mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2} \mathbf{X} \mathbf{\Theta},
where \(\mathbf{\hat{A}} = \mathbf{A} + \mathbf{I}\) denotes the adjacency matrix with inserted self-loops and \(\hat{D}_{ii} = \sum_{j=0} \hat{A}_{ij}\) its diagonal degree matrix. The adjacency matrix can include other values than
1representing edge weights via the optionaledge_weighttensor. Its node-wise formulation is given by: .. math:\mathbf{x}^{\prime}_i = \mathbf{\Theta} \sum_{j \in \mathcal{N}(v) \cup \{ i \}} \frac{e_{j,i}}{\sqrt{\hat{d}_j \hat{d}_i}} \mathbf{x}_j
with \(\hat{d}_i = 1 + \sum_{j \in \mathcal{N}(i)} e_{j,i}\), where \(e_{j,i}\) denotes the edge weight from source node
jto target nodei(default:1.0)- Parameters:
fill_value (float, optional) – The layer computes \(\mathbf{\hat{A}}\) as \(\mathbf{A} + fill_value*\mathbf{I}\). (default:
0.5)cached (bool, optional) – If set to
True, the layer will cache the computation of \(\mathbf{\hat{D}}^{-1} \mathbf{\hat{A}}\) on first execution, and will use the cached version for further executions. This parameter should only be set toTruein transductive learning scenarios. (default:False)add_self_loops (bool, optional) – If set to
False, will not add self-loops to the input graph. (default:True)normalize (bool, optional) – Whether to add self-loops and compute symmetric normalization coefficients on the fly. (default:
True)**kwargs (optional) – Additional arguments of
torch_geometric.nn.conv.MessagePassing.
- fill_value = 0.5
- cached = False
- add_self_loops = True
- normalize = True
- reset_parameters()
- forward(x: torch.Tensor, edge_index: torch_geometric.typing.Adj, edge_weight: torch_geometric.typing.OptTensor = None) torch.Tensor
- message(x_j: torch.Tensor, edge_weight: torch_geometric.typing.OptTensor) torch.Tensor