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

Bases: Module

Deep Anomaly Detection on Attributed Networks

DOMINANT is an anomaly detector consisting of a shared graph convolutional encoder, a structure reconstruction decoder, and an attribute reconstruction decoder. The reconstruction mean squared error of the decoders are defined as structure anomaly score and attribute anomaly score, respectively.

See [DLBL19] for details.

  • in_dim (int) – Input dimension of model.

  • hid_dim (int) – 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..

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

  • sigmoid_s (bool, optional) – Whether to apply sigmoid to the structure reconstruction. Default: False.

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

  • **kwargs (optional) – Additional arguments for the backbone.

forward(x, edge_index)[source]

Forward computation.


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

  • s_ (torch.Tensor) – Reconstructed adjacency matrix.

static process_graph(data)[source]

Obtain the dense adjacency matrix of the graph.


data ( – Input graph.