BatchGIN(in_features, hidden_size, out_features)
Bases: Module
Batch Graph Isomorphism Network layer implementation.
| Parameters: |
|
|---|
forward(x, adj)
Forward pass of GIN layer.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Neighborhood aggregation with self-loop
- Two-layer MLP transformation
- Dropout regularization
BatchGraphConvolution(in_features, out_features, bias=True)
Bases: Module
Batch-wise graph convolution layer.
| Parameters: |
|
|---|
__repr__()
String representation of the module.
| Returns: |
|
|---|
Notes
Format: "BatchGraphConvolution(in_features -> out_features)" Used for model printing and debugging.
forward(x, adj)
Forward pass of the graph convolution layer.
| Parameters: |
|
|---|
| Returns: |
|
|---|
BatchMultiHeadGraphAttention(n_head, in_features, out_features, attn_dropout)
Bases: Module
Multi-head graph attention layer with batch processing.
| Parameters: |
|
|---|
__repr__()
String representation of the module.
| Returns: |
|
|---|
Notes
Format: "BatchMultiHeadGraphAttention(in_features -> out_features)" Used for model printing and debugging.
forward(x, adj)
Forward pass of multi-head attention layer.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Linear projection to n_head spaces
- Compute attention scores
- Apply masked softmax
- Compute output
ClassClassifier(hs, n_class, droprate)
Bases: Module
Node classification network.
| Parameters: |
|
|---|
Notes
Two-layer MLP with dropout and ReLU activation.
forward(x)
Forward pass of classifier.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Hidden layer with dropout and ReLU
- Output layer for class logits
DGDABase(in_dim, num_class, enc_hs, dec_hs, dim_d, dim_y, dim_m, droprate, backbone, source_pretrained_emb, source_vertex_feats, target_pretrained_emb, target_vertex_feats)
Bases: Module
Base class for DGDA.
| Parameters: |
|
|---|
Notes
Implements graph disentanglement with:
- Feature augmentation with pretrained embeddings
- Multi-space encoding (domain, label, manipulation)
- Graph reconstruction and noise modeling
- Domain adversarial training
forward(x, vts, adj, domain, recon=True, alpha=1.0)
Forward pass of DGDA model.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process flow:
- Feature augmentation
- Graph encoding
- Reconstruction (optional)
- Domain and class prediction
DomainClassifier(dim_d)
Bases: Module
Binary domain classifier for adversarial training.
| Parameters: |
|
|---|
Notes
Single linear layer for binary domain classification. Typically used with gradient reversal for domain adaptation.
forward(x)
Forward pass of domain classifier.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Simple linear projection for binary domain classification. Used in conjunction with gradient reversal layer during training.
GNN_VGAE_Encoder(in_dim, hs, dim_d, dim_y, dim_m, droprate, backbone='gcn')
Bases: Module
Variational Graph Auto-Encoder with multiple latent spaces.
| Parameters: |
|
|---|
Notes
Encodes graph into three separate latent spaces:
- Domain space (d)
- Label space (y)
- Manipulation space (m)
forward(x, adj)
Forward pass of the VGAE encoder.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Graph normalization (for GCN backbone)
- Two-layer message passing
- Parallel encoding into three spaces
- Reparameterization for each space
repara(mu, lv)
Reparameterization trick for VAE.
| Parameters: |
|
|---|
| Returns: |
|
|---|
vectorized_sym_norm(adjs)
Compute symmetric normalization of adjacency matrices.
| Parameters: |
|
|---|
| Returns: |
|
|---|
GraphDecoder(dec_hs, dim_d, dim_y, dim_m, droprate)
Bases: Module
Multi-space graph decoder for structure reconstruction.
| Parameters: |
|
|---|
Notes
Reconstructs graph structure from three disentangled spaces:
- Domain space (d)
- Label space (y)
- Manipulation space (m)
forward(d, y, m)
Forward pass of graph decoder.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Independent transformation of each space
- Concatenation of transformed features
- Final projection to common space
- Symmetric matrix construction via outer product
GraphDiscriminator(in_dim, hs, droprate)
Bases: Module
Graph-level discriminator for adversarial training.
| Parameters: |
|
|---|
Notes
Implements a graph-level discriminator with:
- Feature transformation
- Mean pooling
- Binary classification
forward(x)
Forward pass of graph discriminator.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Node feature transformation with dropout
- Mean pooling across nodes
- Final classification layer
NoiseDecoder(dim_m, droprate)
Bases: Module
Decoder network for reconstructing noise patterns in graph structure.
| Parameters: |
|
|---|
forward(x)
Forward pass of noise decoder.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Process:
- Two-layer MLP transformation
- Symmetric matrix construction via outer product