Graph Convolutional Network (GCN)
- class hivegraph.nn.gcn.GCN(num_features: int, num_classes: int, num_layers: int, hidden: int, dropout: float = 0.5, use_jump: bool = False, conv_variant: str = 'GCN', jump_mode: str = 'cat', readout: str = 'mean', model_name: str = 'GCN')[source]
Bases:
ModuleImplementation of Graph Convolutional Network
- Parameters:
num_features (int) – Number of input features.
num_classes (int) – Number of output classes.
num_layers (int) – Number of GINConv layers.
hidden (int) – Number of hidden units.
dropout (float, optional) – Dropout probability. Defaults to 0.5.
use_jump (bool, optional) – If True, use JumpingKnowledge to aggregate representations from all layers. Defaults to False.
conv_variant (str, optional) – Convolutional Layer to be used. Must be one of ‘GCN’ or ‘ResGatedGraph’. Defaults to ‘GCN’.
jump_mode (str, optional) – JumpingKnowledge aggregation mode. Must be one of ‘cat’, ‘max’, or ‘lstm’. Defaults to ‘cat’.
readout (str, optional) – Readout function. Must be one of ‘mean’, ‘max’, or ‘sum’. Defaults to ‘mean’.
Supported convolutional layers:
GCNConv
GraphSAGEConv
ResGatedGraphConv
Supported readout functions:
mean
max
sum
Supported JumpingKnowledge aggregation modes:
cat: Concatenate representations from all layers.
max: Take the maximum representation across all layers.
lstm: Use a LSTM to aggregate representations from all layers.
References
- Raises:
AssertionError – If conv_variant, readout, or jump_mode is not supported.