spamosaic.architectures.hgt.HGT
- class spamosaic.architectures.hgt.HGT(*args: Any, **kwargs: Any)[source]
Heterogeneous Graph Transformer (HGT) model for learning on heterogeneous graphs.
This implementation builds on PyTorch Geometric’s
HGTConvand supports node-type specific input projection, multi-layer HGT attention, and per-type decoders.- Parameters:
in_channels (int) – Input feature dimension for each node.
hidden_channels (int) – Hidden feature dimension used in HGT layers.
num_heads (int) – Number of attention heads in each HGTConv layer.
num_layers (int) – Number of stacked HGTConv layers.
n_dec_l (int) – Number of layers in decoder. If
1, uses a single linear layer.data_obj (HeteroData) – PyG
HeteroDataobject describing node/edge types in the graph.out_channels (int, optional) – If specified, adds an intermediate projection to this dimension before decoding.
- lin_dict
Node-type specific input projections to hidden space.
- Type:
nn.ModuleDict
- convs
List of stacked
HGTConvlayers.- Type:
nn.ModuleList
- decoder
Node-type specific decoders for reconstruction.
- Type:
nn.ModuleDict
- lin
Optional projection layer if
out_channelsis specified.- Type:
nn.Linear or None
- node_type
The primary node type (first in
data_obj.node_types) used for outputs.- Type:
str