graphnetz.models¶
models
¶
DGI
¶
Bases: Module
Deep Graph Infomax for unsupervised node representation learning.
References
- 1: Veličković, P. et al. (2019). "Deep Graph Infomax." ICLR.
Source code in src/graphnetz/models/_dgi.py
GAT
¶
GAT(
in_channels: int,
hidden_channels: int,
out_channels: int,
heads: int = 8,
dropout: float = 0.6,
)
Bases: Module
Two-layer Graph Attention Network.
References
- Velickovic2018: Veličković, P. et al. (2018). "Graph Attention Networks." ICLR.
Source code in src/graphnetz/models/_gat.py
GCN
¶
Bases: Module
Two-layer Graph Convolutional Network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
The number of input features. |
required |
hidden_channels
|
int
|
The number of hidden features. |
required |
out_channels
|
int
|
The number of output features. |
required |
References
- Kipf2017: Kipf, T. N., & Welling, M. (2017). "Semi-Supervised Classification with Graph Convolutional Networks." arXiv:1609.02907.
Source code in src/graphnetz/models/_gcn.py
GIN
¶
Bases: Module
Graph Isomorphism Network for graph-level prediction.
References
- Xu2019: Xu, K. et al. (2019). "How Powerful are Graph Neural Networks?" ICLR.
Source code in src/graphnetz/models/_gin.py
GraphTransformer
¶
GraphTransformer(
in_channels: int,
hidden_channels: int,
out_channels: int,
heads: int = 4,
dropout: float = 0.1,
)
Bases: Module
Two-layer graph transformer based on TransformerConv.
References
- Shi2021: Shi, Y. et al. (2021). "Masked Label Prediction: Unified Message Passing Model for Semi-Supervised Classification." IJCAI.
Source code in src/graphnetz/models/_graph_transformer.py
GraphSAGE
¶
GraphSAGE(
in_channels: int,
hidden_channels: int,
out_channels: int,
aggr: str = "mean",
dropout: float = 0.5,
)
Bases: Module
Two-layer GraphSAGE for node-level prediction.
References
- Hamilton2017: Hamilton, W. L., Ying, R., & Leskovec, J. (2017). "Inductive Representation Learning on Large Graphs." NeurIPS.
Source code in src/graphnetz/models/_graphsage.py
Task type adapters¶
_adapters
¶
Task-type adapters that turn any node-level encoder into a graph-level classifier/regressor or a Deep Graph Infomax model.
This is the glue that lets GCN, GAT, GraphSAGE, and the Graph Transformer plug into every benchmark task in the library, not just node classification.
GraphLevelWrapper
¶
Bases: Module
Wrap a node-level encoder for graph-level prediction.
The encoder is expected to map a PyG Data batch to per-node features
of shape [N, hidden_channels]. The wrapper adds a global mean pool
over the batch index and a linear classification/regression head.
Source code in src/graphnetz/models/_adapters.py
LinkPredWrapper
¶
Bases: Module
Wrap any node-level encoder as a link predictor with a dot-product decoder.
The wrapper exposes encode(data) returning per-node embeddings of shape
[N, hidden_channels] and decode(z, edge_label_index) returning a
[E] tensor of edge logits.
Source code in src/graphnetz/models/_adapters.py
DGIWrapper
¶
DGIWrapper(encoder: Module, hidden_channels: int)
Bases: Module
Wrap any node-level encoder as a Deep Graph Infomax model.
Mirrors the DGI interface (forward(data)
returning the (pos_z, neg_z, summary) triple, plus a loss(...)
helper) so the benchmark trainer does not need to special-case it.