Batched GCN Example - Add dropout, edge features

How can I add dropout to the example (https://docs.dgl.ai/tutorials/basics/4_batch.html)?

I know how to add edge features, but I was wondering how I would design the message passing to not only include the average of node features but also the average of edge features? or some learned weighting of both types in the example (https://docs.dgl.ai/tutorials/basics/4_batch.html) given?

Maruthi

1 Like

By “add dropout”, if you are referring to performing dropout on node features, simply do the modification below:

class GCN(nn.Module):
    def __init__(self, in_feats, out_feats, activation, dropout_rate):
        super(GCN, self).__init__()
        self.apply_mod = NodeApplyModule(in_feats, out_feats, activation)
        self.dropout = nn.Dropout(dropout_rate)

    def forward(self, g, feature):
        # Initialize the node features with h.
        feature = self.dropout(feature)
        g.ndata['h'] = feature
        g.update_all(msg, reduce)
        g.apply_nodes(func=self.apply_mod)
        return g.ndata.pop('h')

For the second issue, you may find our tutorial on RGCN and a related discussion thread to be helpful.

1 Like

It seems that the link has triggered the automatic spam detection by the system and I accidentally approved the spam flagging request. I haven’t figure out how to undo that and I’m sorry for it.