ASNBase(in_dim, hid_dim, hid_dim_vae, num_classes, num_layers=3, act=F.relu, dropout=0.1, adv_dim=40, **kwargs)
Bases: Module
Base class for ASN.
| Parameters: |
|
|---|
Notes
Architecture components:
- Private encoders (local and global) for source/target
- Shared encoders (local and global)
- Decoders for reconstruction
- Domain discriminator
- Attention mechanisms
adj_label_for_reconstruction(data)
Prepare adjacency matrix for reconstruction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
recon_loss(preds, labels, mu, logvar, n_nodes, norm, pos_weight)
Compute reconstruction loss with KL divergence.
| Parameters: |
|
|---|
| Returns: |
|
|---|
DiffLoss()
Bases: Module
Difference loss for enforcing feature separation.
Notes
- Computes normalized feature differences
- Used to encourage orthogonality between domains
- L2 normalization for stability
forward(input1, input2)
Compute difference loss between two feature sets.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
- L2 normalization of inputs
- Computes mean squared inner product
- Encourages orthogonality
GNNVAE(in_dim, hid_dim, num_classes, gnn_type='gcn', num_layers=3, base_model=None, act=F.relu, **kwargs)
Bases: Module
Graph Neural Network Variational Autoencoder.
| Parameters: |
|
|---|
Notes
- Implements variational encoding
- Supports weight sharing
- Multiple GNN layer types
forward(x, edge_index)
Forward pass of GNN-VAE.
| Parameters: |
|
|---|
| Returns: |
|
|---|
reparameterize(mu, logvar)
Perform reparameterization trick.
| Parameters: |
|
|---|
| Returns: |
|
|---|
InnerProductDecoder(dropout, act=torch.sigmoid)
Bases: Module
Decoder module using inner product for graph reconstruction.
| Parameters: |
|
|---|
Notes
- Used for reconstructing adjacency matrices
- Applies dropout for regularization
- Configurable activation function
forward(z)
Decode latent representations to adjacency matrix.
| Parameters: |
|
|---|
| Returns: |
|
|---|