GAEBase#
- class pygod.nn.GAEBase(in_dim, hid_dim=64, num_layers=4, dropout=0.0, act=<function relu>, backbone=<class 'torch_geometric.nn.models.basic_gnn.GCN'>, recon_s=False, sigmoid_s=False, **kwargs)[source]#
Bases:
Module
Graph Autoencoder
See [KW16] for details.
- Parameters:
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. 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, optional) – The backbone of the deep detector implemented in PyG. Default:
torch_geometric.nn.GCN
.recon_s (bool, optional) – Reconstruct the structure instead of node feature . Default:
False
.sigmoid_s (bool, optional) – Whether to use sigmoid function to scale the reconstructed structure. Default:
False
.**kwargs (optional) – Other parameters for the backbone.
- forward(x, edge_index)[source]#
Forward computation.
- Parameters:
x (torch.Tensor) – Input attribute embeddings.
edge_index (torch.Tensor) – Edge index.
- Returns:
x_ – Reconstructed embeddings.
- Return type:
- static process_graph(data, recon_s=False)[source]#
Obtain the dense adjacency matrix of the graph.
- Parameters:
data (torch_geometric.data.Data) – Input graph.
recon_s (bool, optional) – Reconstruct the structure instead of node feature .