MFConv
¶
MFConv(
node_features_dim: Union[int, Tuple[int, int]],
out_features_dim: int,
max_degree: int = 10,
bias: bool = True,
**kwargs,
)
Bases: MessagePassing
Graph convolution layer from the "Convolutional Networks on Graphs for Learning Molecular Fingerprints" paper.
which trains a distinct pair of weight matrices for each possible node
(in-)degree, with degrees larger than max_degree sharing the weights of
max_degree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
Union[int, Tuple[int, int]]
|
Size of input node features, or a |
required |
out_features_dim
|
int
|
Size of output node embeddings |
required |
max_degree
|
int
|
Largest degree with its own weights. Default: |
10
|
bias
|
bool
|
Whether the neighbour projections use a bias. Default: |
True
|
**kwargs
|
Arguments of |
{}
|
Example:
import mlx.core as mx
from mlx_graphs.nn import MFConv
edge_index = mx.array([[0, 1, 2, 3, 4], [1, 0, 3, 2, 0]])
node_features = mx.random.normal((5, 16))
conv = MFConv(16, 32, max_degree=4)
h = conv(edge_index, node_features)
>>> h.shape
(5, 32)
References
[1] Duvenaud et al. Convolutional Networks on Graphs for Learning Molecular Fingerprints.
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of MFConv. |
Source code in mlx_graphs/nn/conv/mf_conv.py
__call__
¶
Computes the forward pass of MFConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Input edge index of shape |
required |
node_features
|
Union[array, Tuple[array, array]]
|
Input node features, or a |
required |
Returns:
| Type | Description |
|---|---|
array
|
The computed node embeddings, one row per destination node |
Source code in mlx_graphs/nn/conv/mf_conv.py
from mlx_graphs.nn import MFConv · mlx_graphs/nn/conv/mf_conv.py