我是图形CNN的新手,正在做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
为什么有多个输入层?这些输出形状的数字表示什么? 我阅读了原始的GraphSAGE论文,但我还不明白。 有人可以告诉我为什么它们是多个输入层,这些数字在输出形状中表示什么?
Graphsage 按节点工作。因此,模型的第一个输入将是来自 Input_layer_1[N, 1, 1433] 的单个节点。 我想,您必须将一个名为num_samples的超参数或每层的样本数设置为[20,10]。因此,为graphsage模型提供节点的生成器将采用进入的第一个节点的20个相邻节点。第二层将占用第一个节点的邻居的另外 10 个邻居。