torch_geometric.nn.models.LINKX

class LINKX(num_nodes: int, in_channels: int, hidden_channels: int, out_channels: int, num_layers: int, num_edge_layers: int = 1, num_node_layers: int = 1, dropout: float = 0.0)[source]

Bases: Module

来自“大规模非同质图学习:新基准和强大的简单方法”论文的LINKX模型。

\[ \begin{align}\begin{aligned}\mathbf{H}_{\mathbf{A}} &= \textrm{MLP}_{\mathbf{A}}(\mathbf{A})\\\mathbf{H}_{\mathbf{X}} &= \textrm{MLP}_{\mathbf{X}}(\mathbf{X})\\\mathbf{Y} &= \textrm{MLP}_{f} \left( \sigma \left( \mathbf{W} [\mathbf{H}_{\mathbf{A}}, \mathbf{H}_{\mathbf{X}}] + \mathbf{H}_{\mathbf{A}} + \mathbf{H}_{\mathbf{X}} \right) \right)\end{aligned}\end{align} \]

注意

有关使用LINKX的示例,请参见examples/linkx.py

Parameters:
  • num_nodes (int) – The number of nodes in the graph.

  • in_channels (int) – Size of each input sample, or -1 to derive the size from the first input(s) to the forward method.

  • hidden_channels (int) – Size of each hidden sample.

  • out_channels (int) – Size of each output sample.

  • num_layers (int) – \(\textrm{MLP}_{f}\) 的层数。

  • num_edge_layers (int, optional) – \(\textrm{MLP}_{\mathbf{A}}\) 的层数。 (默认: 1)

  • num_node_layers (int, optional) – 层数 \(\textrm{MLP}_{\mathbf{X}}\). (默认: 1)

  • dropout (float, optional) – 每个隐藏嵌入的丢弃概率。(默认值:0.0

forward(x: Optional[Tensor], edge_index: Union[Tensor, SparseTensor], edge_weight: Optional[Tensor] = None) Tensor[source]
Return type:

Tensor

reset_parameters()[source]

重置模块的所有可学习参数。