Advertisement

PYG full connection training, GNN feature extraction then processed through fully connected layers.

阅读量:

在许多情况下,在GNN中直接提取节点特征并随后通过全连接层(FC)进行预测能够显示出更好的效果

1. 端到端训练(End-to-End Training)

通过在GNN架构中直接获取节点特征并结合全连接层(FC)进行预测操作,可以让模型实现完全端到端的学习过程。在整个端到端训练过程中,在每次反向传播步骤中都能够被更新优化的网络参数包括GNN模块以及全连接层(FC)中的相关参数。

复制代码
    class GNNWithFC(nn.Module):
    def __init__(self, in_channels, hidden_channels, gnn_out_channels, num_classes):
        super(GNNWithFC, self).__init__()
        self.conv1 = GCNConv(in_channels, hidden_channels)
        self.conv2 = GCNConv(hidden_channels, gnn_out_channels)
        self.fc = nn.Linear(gnn_out_channels, num_classes)
    
    def forward(self, data):
        x, edge_i

全部评论 (0)

还没有任何评论哟~