CoLABase#

class pygod.nn.CoLABase(in_dim, hid_dim=64, num_layers=4, dropout=0.0, act=<function relu>, backbone=<class 'torch_geometric.nn.models.basic_gnn.GCN'>, **kwargs)[source]#

Bases: Module

Anomaly Detection on Attributed Networks via Contrastive Self-Supervised Learning

CoLA is a contrastive self-supervised learning based method for graph anomaly detection. This implementation is base on random neighbor sampling instead of random walk sampling in the original paper.

See [LLP+21] for details.

Parameters:
  • in_dim (int) – Input dimension of model.

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

  • 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.

  • backbone (torch.nn.Module) – The backbone of the deep detector implemented in PyG. Default: torch_geometric.nn.GCN.

  • **kwargs – Other parameters for the backbone.

forward(x, edge_index)[source]#

Forward computation.

Parameters:
Returns:

  • logits (torch.Tensor) – Discriminator logits of positive examples.

  • neg_logits (torch.Tensor) – Discriminator logits of negative examples.