Hey all,
I have defined my GCN model as same as in the example as below and I want to do binary node classification (only 2 labels 0 and 1).
class GCN(nn.Module):
def __init__(self, in_feats, n_hidden, n_classes, n_layers, activation, dropout):
super(GCN, self).__init__()
self.layers = nn.ModuleList()
# input layer
self.layers.append(GraphConv(in_feats, n_hidden, activation=activation))
# hidden layers
for i in range(n_layers - 1):
self.layers.append(GraphConv(n_hidden, n_hidden, activation=activation))
# output layer
self.layers.append(GraphConv(n_hidden, n_classes))
self.dropout = nn.Dropout(p=dropout)
def forward(self, g_dgl, features):
h = features
for i, layer in enumerate(self.layers):
if i != 0:
h = self.dropout(h)
h = layer(g_dgl, h)
return h
When creating the model, I used configuration as followed:
dropout = 0.5; n_hidden = 3; n_layers = 1; learning_rate = 0.01; weight_decay = 0.0005
In addition, I used CrossEntropyLoss() as for my loss function and Adam for the optimizer.
Due to the nature of the problem, I have imbalance nodes in my trained graph, where 59139 nodes are labelled 0 and 20615 nodes are labelled 1. However, a trained model performs so badly that it never predicts node with label 1 correctly.
I’m still working to include edge feature in the model, but I doubt it will improve the model’s performance to predict node label 1. So, I’m asking if anything I can do more in order to make the prediction better?
Thanks a lot for any suggestion