LINKX
¶
LINKX(
num_nodes: int,
node_features_dim: int,
hidden_features_dim: int,
out_features_dim: int,
num_layers: int,
num_edge_layers: int = 1,
num_node_layers: int = 1,
dropout: float = 0.0,
)
Bases: Module
The LINKX model from the "Large Scale Learning on Non-Homophilous Graphs: New Benchmarks and Strong Simple Methods" paper.
The first layer of \(\textrm{MLP}_{\mathbf{A}}\) multiplies the
(sparse) adjacency matrix with a [num_nodes, hidden_features_dim]
weight, i.e. node i gets the sum of the weights of the nodes with an
edge towards it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_nodes
|
int
|
The number of nodes in the graph. |
required |
node_features_dim
|
int
|
Size of the input node features. |
required |
hidden_features_dim
|
int
|
Size of the hidden embeddings. |
required |
out_features_dim
|
int
|
Size of the output. |
required |
num_layers
|
int
|
Number of layers of \(\textrm{MLP}_{f}\). |
required |
num_edge_layers
|
int
|
Number of layers of \(\textrm{MLP}_{\mathbf{A}}\).
Default: |
1
|
num_node_layers
|
int
|
Number of layers of \(\textrm{MLP}_{\mathbf{X}}\).
Default: |
1
|
dropout
|
float
|
Dropout probability of the hidden embeddings of
\(\textrm{MLP}_{f}\). Default: |
0.0
|
Example:
from mlx_graphs.nn import LINKX
model = LINKX(num_nodes, node_features_dim, 64, num_classes, num_layers=2)
logits = model(edge_index, node_features)
References
[1] Lim et al. Large Scale Learning on Non-Homophilous Graphs: New Benchmarks and Strong Simple Methods
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the node predictions. |
Source code in mlx_graphs/nn/models/linkx.py
__call__
¶
__call__(
edge_index: array,
node_features: Optional[array] = None,
edge_weights: Optional[array] = None,
) -> array
Computes the node predictions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Input edge index of shape |
required |
node_features
|
Optional[array]
|
Optional input node features. Without them, only
the graph structure is used. Default: |
None
|
edge_weights
|
Optional[array]
|
Optional weight of each edge. Default: |
None
|
Returns:
| Type | Description |
|---|---|
array
|
An array of shape |
Source code in mlx_graphs/nn/models/linkx.py
from mlx_graphs.nn import LINKX · mlx_graphs/nn/models/linkx.py