【问题标题】:Why are there multiple inputlayers? GraphSAGE为什么有多个输入层? GraphSAGE
【发布时间】:2019-10-23 05:20:33
【问题描述】:

我是图形 CNN 的新手,正在做 tutorials of GraphSAGE。 我运行了 GraphSAGE Cora 节点分类示例,graphsage-cora-example.py。 任务是对cora数据集的节点标签进行分类。

当您运行此代码时,您将获得以下模型摘要:

Layer (type)                    Output Shape         Param # 

    Connected to                     
==================================================================================================
input_2 (InputLayer)            [(None, 20, 1433)]   0                                            
__________________________________________________________________________________________________
input_3 (InputLayer)            [(None, 200, 1433)]  0                                            
__________________________________________________________________________________________________
input_1 (InputLayer)            [(None, 1, 1433)]    0                                            
__________________________________________________________________________________________________
reshape (Reshape)               (None, 1, 20, 1433)  0           input_2[0][0]                    
__________________________________________________________________________________________________
reshape_1 (Reshape)             (None, 20, 10, 1433) 0           input_3[0][0]                    
__________________________________________________________________________________________________
dropout_1 (Dropout)             (None, 1, 1433)      0           input_1[0][0]                    
__________________________________________________________________________________________________
dropout (Dropout)               (None, 1, 20, 1433)  0           reshape[0][0]                    
__________________________________________________________________________________________________
dropout_3 (Dropout)             (None, 20, 1433)     0           input_2[0][0]                    
__________________________________________________________________________________________________
dropout_2 (Dropout)             (None, 20, 10, 1433) 0           reshape_1[0][0]                  
__________________________________________________________________________________________________
mean_aggregator (MeanAggregator multiple             28680       dropout_1[0][0]                  
                                                                 dropout[0][0]                    
                                                                 dropout_3[0][0]                  
                                                                 dropout_2[0][0]                  
__________________________________________________________________________________________________
reshape_2 (Reshape)             (None, 1, 20, 20)    0           mean_aggregator[1][0]            
__________________________________________________________________________________________________
dropout_5 (Dropout)             (None, 1, 20)        0           mean_aggregator[0][0]            
__________________________________________________________________________________________________
dropout_4 (Dropout)             (None, 1, 20, 20)    0           reshape_2[0][0]                  
__________________________________________________________________________________________________
mean_aggregator_1 (MeanAggregat (None, 1, 20)        420         dropout_5[0][0]                  
                                                                 dropout_4[0][0]                  
__________________________________________________________________________________________________
reshape_3 (Reshape)             (None, 20)           0           mean_aggregator_1[0][0]          
__________________________________________________________________________________________________
lambda (Lambda)                 (None, 20)           0           reshape_3[0][0]                  
__________________________________________________________________________________________________
dense (Dense)                   (None, 7)            147         lambda[0][0]                     
==================================================================================================
Total params: 29,247
Trainable params: 29,247
Non-trainable params: 0

为什么有多个输入层?这些输出形状的数字表示什么? 我读了the original GraphSAGE paper,但我还不明白。 有人能告诉我为什么它们是多个 InputLayers 吗?这些数字在 Output Shape 中表示什么?

【问题讨论】:

  • 你能修复论文的链接吗?

标签: python machine-learning graph keras neural-network


【解决方案1】:

Graphsage 以节点方式工作。因此,您对模型的第一个输入将是来自 Input_layer_1[N, 1, 1433] 的单个节点。 而且我猜,您必须将一个名为 num_samples 的超参数或每层的样本数设置为 [20, 10]。因此,将节点提供给 graphsage 模型的生成器将采用进入的第一个节点的 20 个相邻节点。第二层将采用第一个节点的邻居的 10 个以上的邻居。

【讨论】:

  • 简单来说:Input_layer_1 = [N, 1, 1433] Input_layer_2 = [N, 20, 1433]---第一个Node的邻居。 Input_layer_3 = [N, 200, 1433]---第一个节点的Neighbors of Neighbors。 PS:尝试将 Num_Samples 更改为 like [5, 10] 然后你会得到 layer_1 = [N, 1, 1433], layer_2 = [N, 5, 1433], layer_3 = [N, 50, 1433]
猜你喜欢
  • 2021-04-21
  • 1970-01-01
  • 2021-07-01
  • 2019-03-06
  • 1970-01-01
  • 2021-04-04
  • 1970-01-01
  • 2019-09-17
  • 2019-03-28
相关资源
最近更新 更多