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 HGTConv and 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) – A PyG HeteroData object describing the node and edge types in the graph.
out_channels (int, optional) – If specified, adds an intermediate projection layer to this dimension before decoding.
- lin_dict
Node-type specific input projections to hidden space.
- Type:
nn.ModuleDict
- convs
List of stacked HGTConv layers.
- Type:
nn.ModuleList
- decoder
Node-type specific decoders for reconstruction.
- Type:
nn.ModuleDict
- lin
Optional projection layer if out_channels is specified.
- Type:
nn.Linear, optional
- node_type
The target node type for downstream prediction.
- Type:
str