ACDNEBase(n_input, n_hidden, n_emb, num_class, batch_size, drop)

Bases: Module

Base class for ACDNE.

Parameters:
  • n_input (int) –

    Input feature dimension.

  • n_hidden (list) –

    Hidden layer dimensions.

  • n_emb (int) –

    Embedding dimension.

  • num_class (int) –

    Number of classes.

  • batch_size (int) –

    Size of mini-batches.

  • drop (float) –

    Dropout rate.

Notes

Architecture components:

  1. Network embedding module
  2. Node classifier
  3. Domain discriminator
forward(x, x_nei, alpha)

Forward pass of ACDNE model.

Parameters:
  • x (Tensor) –

    Input node features.

  • x_nei (Tensor) –

    Neighbor features.

  • alpha (float) –

    Gradient reversal scaling parameter.

Returns:
  • tuple

    Contains: - emb : Network embeddings - pred_logit : Classification logits - d_logit : Domain classification logits

Notes

Three-stage process: 1. Network embedding 2. Node classification 3. Domain discrimination with gradient reversal

DomainDiscriminator(n_emb)

Bases: Module

Domain discriminator for adversarial training.

Parameters:
  • n_emb (int) –

    Input embedding dimension.

Notes
  • Three-layer neural network
  • Binary domain classification
  • Used with gradient reversal
forward(h_grl)

Forward pass of domain discriminator.

Parameters:
  • h_grl (Tensor) –

    Input features after gradient reversal.

Returns:
  • Tensor

    Domain classification logits.

FE1(n_input, n_hidden, drop)

Bases: Module

First Feature Encoder for self-features.

Parameters:
  • n_input (int) –

    Input feature dimension.

  • n_hidden (list) –

    Hidden layer dimensions [h1_dim, h2_dim].

  • drop (float) –

    Dropout rate.

Notes
  • Two-layer neural network for self-feature encoding
  • Uses truncated normal initialization
  • Applies ReLU activation and dropout
forward(x)

Forward pass of self-feature encoder.

Parameters:
  • x (Tensor) –

    Input node features.

Returns:
  • Tensor

    Encoded self-features.

Notes
  • Two-layer transformation with ReLU
  • Dropout after first layer
FE2(n_input, n_hidden, drop)

Bases: Module

Second Feature Encoder for neighbor-features.

Parameters:
  • n_input (int) –

    Input feature dimension.

  • n_hidden (list) –

    Hidden layer dimensions [h1_dim, h2_dim].

  • drop (float) –

    Dropout rate.

Notes
  • Parallel to FE1 but processes neighbor features
  • Identical architecture to FE1
  • Separate parameters for neighbor processing
forward(x_nei)

Forward pass of neighbor-feature encoder.

Parameters:
  • x_nei (Tensor) –

    Input neighbor features.

Returns:
  • Tensor

    Encoded neighbor features.

NetworkEmbedding(n_input, n_hidden, n_emb, drop, batch_size)

Bases: Module

Network Embedding module combining self and neighbor features.

Parameters:
  • n_input (int) –

    Input feature dimension.

  • n_hidden (list) –

    Hidden layer dimensions.

  • n_emb (int) –

    Final embedding dimension.

  • drop (float) –

    Dropout rate.

  • batch_size (int) –

    Size of mini-batches.

Notes
  • Combines FE1 and FE2 outputs
  • Projects combined features to embedding space
  • Supports pairwise constraints for domain adaptation
forward(x, x_nei)

Forward pass of network embedding.

Parameters:
  • x (Tensor) –

    Self features.

  • x_nei (Tensor) –

    Neighbor features.

Returns:
  • Tensor

    Combined network embedding.

net_pro_loss(emb, a) staticmethod

Network proximity loss computation.

Parameters:
  • emb (Tensor) –

    Network embeddings.

  • a (Tensor) –

    Adjacency matrix.

Returns:
  • Tensor

    Network proximity loss.

Notes
  • Computes pairwise distances in embedding space
  • Weighted by adjacency matrix
pairwise_constraint(emb)

Split embeddings into source and target domains.

Parameters:
  • emb (Tensor) –

    Combined embeddings.

Returns:
  • tuple

    Source and target embeddings.

NodeClassifier(n_emb, num_class)

Bases: Module

Node classification layer.

Parameters:
  • n_emb (int) –

    Input embedding dimension.

  • num_class (int) –

    Number of classes.

Notes
  • Single linear layer classifier
  • Uses truncated normal initialization
forward(emb)

Forward pass of classifier.

Parameters:
  • emb (Tensor) –

    Input embeddings.

Returns:
  • Tensor

    Classification logits.