GraphATABase(in_dim, hid_dim, num_classes, model_weights, model_list, num_layers=1, dropout=0.1, act=F.relu, gnn='gcn', mode='node', **kwargs)
Bases: Module
Base model for GraphATA.
This is the base implementation of a graph neural network that uses node-centric attention mechanisms for feature transformation and classification. It supports both node-level and graph-level tasks through a flexible architecture.
| Parameters: |
|
|---|
| Attributes: |
|
|---|
Notes
Architecture components:
-
Feature Transformation:
- Multiple NodeCentricConv layers
- Activation and dropout between layers
- Attention-based feature aggregation
-
Task-Specific Processing:
- Node-level: Direct classification
- Graph-level: Global pooling before classification
-
Classification:
- Ensemble of models with attention
- Task-specific output handling
- Log-softmax normalization
Examples:
>>> model = GraphATABase(
... in_dim=64,
... hid_dim=32,
... num_classes=7,
... model_weights=weights,
... model_list=models,
... num_layers=2,
... mode='node'
... )
>>> x = torch.randn(100, 64) # 100 nodes, 64 features
>>> edge_index = torch.randint(0, 100, (2, 400)) # 400 edges
>>> out = model(x, edge_index) # Shape: (100, 7)
feat_bottleneck(x, edge_index, edge_weight=None, batch=None)
Feature extraction through GNN layers.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
-
Sequential GNN layer application:
- NodeCentricConv transformation
- Feature aggregation with attention
-
Regularization:
- Activation between layers (except last)
- Dropout for training stability
- Residual connections through attention
feat_classifier(x, edge_index, edge_weight=None, batch=None)
Final classification layer.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Operation modes:
-
Node mode:
-
Uses GNN classifier with edge information
-
Maintains graph structure in classification
-
Graph mode:
-
Uses pooled features
- Global classification without edge information
forward(x, edge_index, edge_weight=None, batch=None)
Forward pass of the GNN model.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
-
Feature transformation through GNN layers:
- Sequential application of NodeCentricConv
- Attention-based feature aggregation
- Activation and dropout between layers
-
Task-specific processing:
- Node mode: Direct use of node features
- Graph mode: Global mean pooling over nodes
-
Classification:
- Attention-based ensemble classification
- Log-softmax normalization