Skip to content

Commit 72c39d4

Browse files
committedApr 27, 2019
readme
1 parent a50fe9b commit 72c39d4

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed
 

‎README.MD

+18
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
# Graph Convolution Network for TF2
2+
3+
GCN implementation for paper: [Semi-Supervised Classification with Graph Convolutional Networks](https://arxiv.org/pdf/1609.02907.pdf)
4+
5+
# Benchmark
6+
7+
| dataset | Citeseea | Cora | Pubmed | NELL |
8+
|---------------|----------|------|--------|------|
9+
| GCN(official) | 70.3 | 81.5 | 79.0 | 66.0 |
10+
| This repo. | | 81.8 | | |
11+
12+
# HOWTO
13+
```
14+
python train.py
15+
```
16+
17+
# Screenshot
18+
19+
![](res/scree.png)

‎layers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def call(self, inputs, training=None):
124124
x, support_ = inputs
125125

126126
# dropout
127-
if training and self.is_sparse_inputs:
127+
if training is not False and self.is_sparse_inputs:
128128
x = sparse_dropout(x, self.dropout, self.num_features_nonzero)
129-
elif training:
129+
elif training is not False:
130130
x = tf.nn.dropout(x, self.dropout)
131131

132132

‎models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def call(self, inputs, training=None):
9696
outputs = [x]
9797

9898
for layer in self.layers:
99-
hidden = layer((outputs[-1], support))
99+
hidden = layer((outputs[-1], support), training)
100100
outputs.append(hidden)
101101
output = outputs[-1]
102102

‎res/screen.png

168 KB
Loading

‎train.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
train_mask = tf.convert_to_tensor(train_mask)
6464
val_label = tf.convert_to_tensor(y_val)
6565
val_mask = tf.convert_to_tensor(val_mask)
66+
test_label = tf.convert_to_tensor(y_test)
67+
test_mask = tf.convert_to_tensor(test_mask)
6668
features = tf.SparseTensor(*features)
6769
support = [tf.cast(tf.SparseTensor(*support[0]), dtype=tf.float32)]
6870
num_features_nonzero = features.values.shape
@@ -71,7 +73,6 @@
7173

7274
optimizer = optimizers.Adam(lr=1e-2)
7375

74-
cost_val = []
7576

7677

7778
for epoch in range(args.epochs):
@@ -85,4 +86,11 @@
8586
_, val_acc = model((features, val_label, val_mask, support), training=False)
8687

8788

88-
print(epoch, float(loss), float(acc), '\tval:', float(val_acc))
89+
print(epoch, float(loss), float(acc), '\tval:', float(val_acc))
90+
91+
92+
93+
test_loss, test_acc = model((features, test_label, test_mask, support), training=False)
94+
95+
96+
print('\ttest:', float(test_loss), float(test_acc))

0 commit comments

Comments
 (0)
Please sign in to comment.