PNA
¶
PNA(
node_features_dim: Union[int, Tuple[int, int]],
hidden_features_dim: int,
num_layers: int,
out_features_dim: Optional[int] = None,
dropout: float = 0.0,
act: Activation = "relu",
norm: Normalization = None,
jk: Optional[Literal["cat", "max", "lstm"]] = None,
**kwargs: Any,
)
Bases: BasicGNN
Principal Neighbourhood Aggregation network from "Principal Neighbourhood Aggregation for Graph Nets", a stack of
PNAConv layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
Union[int, Tuple[int, int]]
|
Size of the input node features. |
required |
hidden_features_dim
|
int
|
Size of the hidden node embeddings. |
required |
num_layers
|
int
|
Number of message passing layers. |
required |
out_features_dim
|
Optional[int]
|
Size of the output. Default: |
None
|
dropout
|
float
|
Dropout probability. Default: |
0.0
|
act
|
Activation
|
Activation between layers. Default: |
'relu'
|
norm
|
Normalization
|
Normalization between layers. Default: |
None
|
jk
|
Optional[Literal['cat', 'max', 'lstm']]
|
Jumping Knowledge mode. Default: |
None
|
**kwargs
|
Any
|
Arguments of |
{}
|
Example:
from mlx_graphs.nn import PNA, PNAConv
deg = PNAConv.get_degree_histogram(train_dataset)
model = PNA(
dataset.num_node_features,
64,
num_layers=3,
out_features_dim=dataset.num_graph_classes,
aggregators=["mean", "min", "max", "std"],
scalers=["identity", "amplification", "attenuation"],
deg=deg,
)
h = model(graph.edge_index, graph.node_features)
Source code in mlx_graphs/nn/models/basic_gnn.py
from mlx_graphs.nn import PNA · mlx_graphs/nn/models/pna.py