CRIPAC-DIG / TextING

[ACL 2020] Tensorflow implementation for "Every Document Owns Its Structure: Inductive Text Classification via Graph Neural Networks"
180 stars 57 forks source link

直接使用GCN的实验效果? The experimental of using GCN directly? #20

Closed A11en0 closed 3 years ago

A11en0 commented 3 years ago

您好,感谢您有价值的工作!

  1. 请问有直接使用GCN来做过这种多图的实验吗(区别于TextGCN)?
  2. 自环对该实验效果有多大影响?

Hello, thank you for your valuable work!

  1. Have you ever done this kind of multi-image experiment directly using GCN (different from TextGCN)?
  2. How much influence does the self-loop have on the effect of this experiment?
A11en0 commented 3 years ago

我自己使用Pyg实现了一下,效果很差,不知道是否是我代码的问题?

I used Pyg to implement it myself, and the effect is very poor. I don't know if it is the problem with my code?

class GCN(torch.nn.Module):
    def __init__(self, nfeat, nhid, nclass, dropout):
        super(GCN, self).__init__()
        self.conv1 = GCNConv(nfeat, nhid, normalize=True)
        self.conv2 = GCNConv(nhid, nclass, normalize=True)
        self.dropout = dropout

    def forward(self, x, edge_index, edge_weight, batch):
        x = F.relu(self.conv1(x, edge_index, edge_weight))
        x = torch.dropout(x, self.dropout, train=self.training)
        x = self.conv2(x, edge_index, edge_weight)
        x = global_max_pool(x, batch)
        return F.log_softmax(x, dim=1)

Edit: 刚刚没有加Glove,加上后在MR上达到73%左右。

image

直接使用GateGCN,loss异常,为负值:

class GateGCN(torch.nn.Module):
    def __init__(self, nfeat, nhid, nclass, dropout):
        super(GateGCN, self).__init__()

        self.gateconv = GatedGraphConv(out_channels=300, num_layers=3, aggr='add')

    def forward(self, x, edge_index, edge_weight, batch):
        x = self.gateconv(x, edge_index, edge_weight)
        h = global_max_pool(x, batch)

        return h
Huasheng-hou commented 3 years ago

我使用pytorch实现代码,细节和作者一模一样,只有mr和R8有一定结果,而且准确率也差了几个点,R52和ohsumed目前还没有训练出来结果

Magicat128 commented 3 years ago

@A11en0

您好,我个人之前使用GCN也没能取得很好效果,可能是GCN聚合方式较为简单,而小图的信息又比较有限,Gate更有利于信息的抽取;关于自环,默认是去掉自环的,因为Gate机制中已经带有上一状态。

Hi, I tried GCN and didn't get desired results before. I guess the aggregation operation in GCN is too straightforward to incorporate enough messages in each individual graph, while Gate can. And the model doesn't have the self-loop because the Gate mechanism already contains that.

Magicat128 commented 3 years ago

@Huasheng-hou

您好,这里有一篇非官方的torch版本,供参考 https://blog.csdn.net/qq_28969139/article/details/107849798

Huasheng-hou commented 3 years ago

@Huasheng-hou

您好,这里有一篇非官方的torch版本,供参考 https://blog.csdn.net/qq_28969139/article/details/107849798

非常感谢,我试试

A11en0 commented 3 years ago

@A11en0

您好,我个人之前使用GCN也没能取得很好效果,可能是GCN聚合方式较为简单,而小图的信息又比较有限,Gate更有利于信息的抽取;关于自环,默认是去掉自环的,因为Gate机制中已经带有上一状态。

Hi, I tried GCN and didn't get desired results before. I guess the aggregation operation in GCN is too straightforward to incorporate enough messages in each individual graph, while Gate can. And the model doesn't have the self-loop because the Gate mechanism already contains that.

感谢回复!我个人的一些发现,欢迎指正:

  1. 使用Glove初始化节点特征十分重要,可能是由于在小图中one-hot编码无法很好地学习到特征。
  2. 我理解不管是GCN还是GGCN,只不过起到编码器的作用,实际上本文效果好的原因更多是由于readout的存在?不知道有没有进行过消融?

Thanks Reply! Some of my personal findings, please correct me:

  1. It is very important to use Glove to initialize the node features, which may be due to the inability to learn the features well in the one-hot encoding in the small graph.

  2. I understand that whether it is GCN or GGCN, it only functions as an encoder. In fact, the reason why this article works well is more due to the existence of readout? I wonder if ablation has been performed?

Magicat128 commented 3 years ago

@A11en0

readout确实是比较重要的一部分,因为这里把节点分类问题变成了图分类问题,不可避免地需要引入readout, 也没有做消融。

Yes, the readout is quite important, as the task becomes a graph classification problem rather than a node classification problem. And no ablation study on it.