BGNN_MLP
- class dhg.models.BGNN_MLP(*args, **kwargs)[source]
Bases:
torch.nn.Module
The BGNN-MLP model proposed in Cascade-BGNN: Toward Efficient Self-supervised Representation Learning on Large-scale Bipartite Graphs paper (TNNLS 2020).
- Parameters
u_dim (
int
) – The dimension of the vertex feature in set \(U\).v_dim (
int
) – The dimension of the vertex feature in set \(V\).hid_dim (
int
) – The dimension of the hidden layer.decoder_hid_dim (
int
) – The dimension of the hidden layer in the decoder.drop_rate (
float
) – The dropout rate. Default:0.5
.layer_depth (
int
) – The depth of layers. Default:3
.
- forward(X_u, X_v, g)[source]
The forward function.
- Parameters
X_u (
torch.Tensor
) – The feature matrix of vertices in set \(U\).X_v (
torch.Tensor
) – The feature matrix of vertices in set \(V\).g (
BiGraph
) – The bipartite graph.
- train_with_cascaded(X_u, X_v, g, lr, weight_decay, max_epoch, device='cpu')[source]
Train the model with cascaded strategy.
- Parameters
X_u (
torch.Tensor
) – The feature matrix of vertices in set \(U\).X_v (
torch.Tensor
) – The feature matrix of vertices in set \(V\).g (
BiGraph
) – The bipartite graph.lr (
float
) – The learning rate.weight_decay (
float
) – The weight decay.max_epoch (
int
) – The maximum number of epochs.device (
str
) – The device to use. Default:"cpu"
.