UniSAGEConv

class dhg.nn.UniSAGEConv(*args, **kwargs)[source]

Bases: torch.nn.Module

The UniSAGE convolution layer proposed in UniGNN: a Unified Framework for Graph and Hypergraph Neural Networks paper (IJCAI 2021).

Sparse Format:

\[\begin{split}\left\{ \begin{aligned} h_{e} &= \frac{1}{|e|} \sum_{j \in e} x_{j} \\ \tilde{x}_{i} &= W\left(x_{i}+\text { AGGREGATE }\left(\left\{x_{j}\right\}_{j \in \mathcal{N}_{i}}\right)\right) \end{aligned} \right. .\end{split}\]

Matrix Format:

\[\mathbf{X}^{\prime} = \sigma \left( \left( \mathbf{I} + \mathbf{H} \mathbf{D}_e^{-1} \mathbf{H}^\top \right) \mathbf{X} \mathbf{\Theta} \right) .\]
Parameters
  • in_channels (int) – \(C_{in}\) is the number of input channels.

  • out_channels (int) – \(C_{out}\) is the number of output channels.

  • bias (bool) – If set to False, the layer will not learn the bias parameter. Defaults to True.

  • use_bn (bool) – If set to True, the layer will use batch normalization. Defaults to False.

  • drop_rate (float) – If set to a positive number, the layer will use dropout. Defaults to 0.5.

  • is_last (bool) – If set to True, the layer will not apply the final activation and dropout functions. Defaults to False.

forward(X, hg)[source]

The forward function.

Parameters
  • X (torch.Tensor) – Input vertex feature matrix. Size \((|\mathcal{V}|, C_{in})\).

  • hg (dhg.Hypergraph) – The hypergraph structure that contains \(|\mathcal{V}|\) vertices.