图神经网络回归

时间:2021-06-30 22:50:14

标签: python graph neural-network pytorch

我正在尝试在图神经网络上实现回归。我看到的大多数示例都是该领域的分类示例,到目前为止还没有回归。我看到一个分类如下: 从 torch_geometric.nn 导入 GCNConv

class GCN(torch.nn.Module):
def __init__(self, hidden_channels):
    super(GCN, self).__init__()
    torch.manual_seed(12345)
    self.conv1 = GCNConv(dataset.num_features, hidden_channels)
    self.conv2 = GCNConv(hidden_channels, dataset.num_classes)

def forward(self, x, edge_index):
    x = self.conv1(x, edge_index)
    x = x.relu()
    x = F.dropout(x, p=0.5, training=self.training)
    x = self.conv2(x, edge_index)
    return x

model = GCN(hidden_channels=16)
print(model)

我正在尝试为我的任务修改它,这基本上包括在具有 30 个节点的网络上执行回归,每个节点有 3 个特征,边缘有一个特征。

如果有人能指点我做同样事情的例子,那将非常有帮助。

0 个答案:

没有答案