Is there a implementation about inductive link prediction?
wierdoki opened this issue · 5 comments
There seems to be only codes about transductive learning of seen nodes? plz correct me if I'm wrong.
I guess I can add a function with new unseen node as placeholder input to replace the self.X in the calculation of self.mu and self.sigma, though, I'd be grateful if you can share your implementation about this inductive link prediction part.
That's right. I'll update the code to include an inductive variant in the coming days. In the meantime, replacing self.X
with a placeholder should be an effective solution.
Hi,
I added some code enabling the evaluation of the inductive variant. Here's a short example snippet:
from g2g.model import Graph2Gauss
from g2g.utils import load_dataset, score_link_prediction
g = load_dataset('data/cora_ml.npz')
A, X, z = g['A'], g['X'], g['z']
g2g = Graph2Gauss(A=A, X=X, L=64, verbose=True, p_val=0.10, p_test=0.05, p_nodes=0.1)
sess = g2g.train()
ind_auc, ind_ap = score_link_prediction(g2g.ind_ground_truth,
sess.run(g2g.neg_ind_energy, g2g.ind_feed_dict))
print('ind_auc: {:.4f}, ind_ap: {:.4f}'.format(ind_auc, ind_ap))
The parameter p_nodes
specifies the percentage of nodes to hide for inductive evaluation.
You might get ... UserWarning: Converting sparse IndexedSlices ...
warning when using the inductive variant. At the moment there is no clean way to avoid this.
Hi,
We are not able to reproduce your results on the inductive setting (with p_nodes = 0.1) using the default hyperparameters. We obtained AUC of 75.7
on citeseer as opposed to 88.58
reported in the paper. Could you please let us know what configuration you ran with.
Thanks in advance
Hi,
I will look into my logs and try to find the exact hyperparameters we used for that experiment. In the meantime, can you please share the relevant code snippet that you ran?
I just ran the following:
g = load_dataset('data/citeseer.npz')
A, X, z = g['A'], g['X'], g['z']
g2g = Graph2Gauss(A=A, X=X, L=64, verbose=True, p_val=0.10, p_test=0.0, p_nodes=0.1)
sess = g2g.train()
ind_auc, ind_ap = score_link_prediction(g2g.ind_ground_truth,
sess.run(g2g.neg_ind_energy, g2g.ind_feed_dict))
print('ind_auc: {:.4f}, ind_ap: {:.4f}'.format(ind_auc, ind_ap))
and obtained:
ind_auc: 0.9071, ind_ap: 0.8126
Thanks a lot, there was some mistake from our end. The above sample gave the reported results.