class pygod.nn.GUIDEBase(dim_a, dim_s, hid_a=64, hid_s=4, num_layers=4, dropout=0.0, act=<function relu>, **kwargs)[source]

Bases: Module

Higher-order Structure based Anomaly Detection on Attributed Networks

GUIDE is an anomaly detector consisting of an attribute graph convolutional autoencoder, and a structure graph attentive autoencoder (not the same as the graph attention networks). Instead of the adjacency matrix, node motif degree is used as input of structure autoencoder. The reconstruction mean square error of the autoencoders are defined as structure anomaly score and attribute anomaly score, respectively.

Note: The calculation of node motif degree in preprocessing has high time complexity. It may take longer than you expect.

See [YZY+21] for details.

  • dim_a (int) – Input dimension for attribute.

  • dim_s (int) – Input dimension for structure.

  • hid_a (int, optional) – Hidden dimension for attribute. Default: 64.

  • hid_s (int, optional) – Hidden dimension for structure. Default: 4.

  • num_layers (int, optional) – Total number of layers in model. Default: 4.

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

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

  • **kwargs – Other parameters for GCN.

forward(x, s, edge_index)[source]

Forward computation of GUIDE.


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

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