class pygod.nn.AdONEBase(x_dim, s_dim, hid_dim=64, num_layers=4, dropout=0.0, act=<function relu>, w1=0.2, w2=0.2, w3=0.2, w4=0.2, w5=0.2, **kwargs)[source]

Bases: Module

Adversarial Outlier Aware Attributed Network Embedding

AdONE consists of an attribute autoencoder and a structure autoencoder. It estimates five loss to optimize the model, including an attribute proximity loss, an attribute homophily loss, a structure proximity loss, a structure homophily loss, and an alignment loss. It calculates three outlier scores, and averages them as an overall score. This model is transductive only.

See [BVM20] for details.

  • x_dim (int) – Input dimension of attribute.

  • s_dim (int) – Input dimension of structure.

  • hid_dim (int, optional) – Hidden dimension of model. Default: 64.

  • num_layers (int, optional) – Total number of layers in model. A half (floor) of the layers are for the encoder, the other half (ceil) of the layers are for decoders. Default: 4.

  • dropout (float, optional) – Dropout rate. Default: 0..

  • weight_decay (float, optional) – Weight decay (L2 penalty). Default: 0..

  • act (callable activation function or None, optional) – Activation function if not None. Default: torch.nn.functional.relu.

  • w1 (float, optional) – Weight of structure proximity loss. Default: 0.2.

  • w2 (float, optional) – Weight of structure homophily loss. Default: 0.2.

  • w3 (float, optional) – Weight of attribute proximity loss. Default: 0.2.

  • w4 (float, optional) – Weight of attribute homophily loss. Default: 0.2.

  • w5 (float, optional) – Weight of alignment loss. Default: 0.2.

  • **kwargs – Other parameters for the backbone.

forward(x, s, edge_index)[source]

Forward computation.


  • x_ (torch.Tensor) – Reconstructed attribute embeddings.

  • s_ (torch.Tensor) – Reconstructed structure embeddings.

  • h_a (torch.Tensor) – Attribute hidden embeddings.

  • h_s (torch.Tensor) – Structure hidden embeddings.

  • dna (torch.Tensor) – Attribute neighbor distance.

  • dns (torch.Tensor) – Structure neighbor distance.

  • dis_a (torch.Tensor) – Attribute discriminator score.

  • dis_s (torch.Tensor) – Structure discriminator score.

static process_graph(data)[source]

Obtain the dense adjacency matrix of the graph.


data ( – Input graph.