Skip to content

Commit 153d7da

Browse files
Merge pull request #109 from otiliastr:fix_edges
PiperOrigin-RevId: 425667058
2 parents a43fcfc + b158aa5 commit 153d7da

File tree

7 files changed

+37
-17
lines changed

7 files changed

+37
-17
lines changed

research/gam/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ More details can be found in our
4040
[slides](https://drive.google.com/open?id=1tWEMoyrbLnzfSfTfYFi9eWgZWaPKF3Uu) or
4141
[poster](https://drive.google.com/file/d/1BZNR4B-xM41hdLLqx4mLsQ4KKJOhjgqV/view).
4242

43+
## Updated Results
44+
45+
A bug was discovered in the implementation of the GAM agreement regularization
46+
term after publication. We have fixed the bug (PR #82) and have rerun the
47+
affected experiments. Below are the updated results (note that the GAM* results
48+
are not affected).
49+
50+
<img src="img/gam-updated-results.png " width="400">
51+
52+
Although some of these numbers are lower than what was originally reported, the
53+
takeaways presented in our paper still hold: GAM adds a significant boost to the
54+
original base models, and also performs better than other forms of
55+
regularization reported in our paper. Nevertheless, we apologize for any
56+
inconvenience caused by this bug!
57+
4358
## How to run
4459

4560
To run GAM on a graph-based dataset (e.g., Cora, Citeseer, Pubmed), from this
@@ -63,13 +78,13 @@ the dataset name accordingly: `$ tensorboard --logdir=outputs/summaries/cora`
6378

6479
An example of such visualization for Cora with GCN + GAM model on the Pubmed
6580
dataset is the following:
66-
![Tensorboard plot](gam_gcn_pubmed.png?raw=true "GCN + GAM on Pubmed")
81+
![Tensorboard plot](img/gam_gcn_pubmed.png?raw=true "GCN + GAM on Pubmed")
6782

6883
Similarly, we can run with multiple different parameter configurations and plot
6984
the results together for comparison. An example showing the accuracy per
7085
co-train iteration of a GCN + GAM model on the Cora dataset for 3 runs with 3
7186
different random seeds is the following:
72-
![Tensorboard plot](gam_gcn_cora_multiple_seeds.png?raw=true "GCN + GAM on Cora")
87+
![Tensorboard plot](img/gam_gcn_cora_multiple_seeds.png?raw=true "GCN + GAM on Cora")
7388

7489
## References
7590

research/gam/gam/trainer/trainer_classification_gcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ def train(self, data, session=None, **kwargs):
871871

872872
def predict(self, session, indices, is_train):
873873
"""Make predictions for the provided sample indices."""
874-
if not indices:
874+
if not indices.shape[0]:
875875
return np.zeros((0, self.data.num_classes), dtype=np.float32)
876876
feed_dict = {
877877
self.input_indices: indices,

research/gam/gam/trainer/trainer_cotrain.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,15 @@ def _select_samples_to_label(self, data, trainer_cls, session):
355355
assign to each of the selected nodes.
356356
"""
357357
# Select the candidate samples for self-labeling, and make predictions.
358-
# Remove the validation samples from the unlabeled data, if there, to avoid
359-
# self-labeling them.
358+
# We remove the validation and test samples from the unlabeled data,
359+
# to avoid self-labeling them. We could potentially allow them to be
360+
# self-labeled, but once a node is self-labeled its label is fixed for
361+
# the remaining co-train iterations, so it would not take advantage
362+
# of the improved versions of the model.
360363
indices_unlabeled = data.get_indices_unlabeled()
361-
val_ind = set(data.get_indices_val())
364+
eval_ind = set(data.get_indices_val()) | set(data.get_indices_test())
362365
indices_unlabeled = np.asarray(
363-
[ind for ind in indices_unlabeled if ind not in val_ind])
366+
[ind for ind in indices_unlabeled if ind not in eval_ind])
364367
predictions = trainer_cls.predict(
365368
session, indices_unlabeled, is_train=False)
366369

@@ -546,8 +549,8 @@ def train(self, data, **kwargs):
546549

547550
# Create a saver which saves only the variables that we would need to
548551
# restore in case the training process is restarted.
549-
vars_to_save = [iter_cotrain] + trainer_agr.vars_to_save + \
550-
trainer_cls.vars_to_save
552+
vars_to_save = [iter_cotrain
553+
] + trainer_agr.vars_to_save + trainer_cls.vars_to_save
551554
saver = tf.train.Saver(vars_to_save)
552555

553556
# Create a TensorFlow session. We allow soft placement in order to place
@@ -633,7 +636,9 @@ def train(self, data, **kwargs):
633636
logging.info(
634637
'--------- Cotrain step %6d | Accuracy val: %10.4f | '
635638
'Accuracy test: %10.4f ---------', step, val_acc, test_acc)
636-
639+
logging.info(
640+
'Best validation acc: %.4f, corresponding test acc: %.4f at '
641+
'iteration %d', best_val_acc, test_acc_at_best, iter_at_best)
637642
if self.first_iter_original and step == 0:
638643
logging.info('No self-labeling because the first iteration trains the '
639644
'original classifier for evaluation purposes.')
124 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)